[Enhancement] Eventize the spillable sort - #74590
Conversation
|
@codex review |
|
No new undocumented parameters detected by the param-drift check. |
🌎 Translation Required?✅ All translation files are up to date.
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e92b471081
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
13b4297 to
02e632e
Compare
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 02e632e6f1
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
1e02a64 to
773c060
Compare
d1761ef to
fd63883
Compare
fd63883 to
9cc0bd8
Compare
7fcfa66 to
b80df57
Compare
|
@eshishki could u rebase this PR ? I want to push for this PR to be merged. |
Move the spillable sort onto the pipeline event scheduler: the partition sort sink and both the single-merge and parallel-merge sources park and are woken by the partition spillers' flush-all / restore completions rather than busy-polling. Gated on enable_spill_sort_events (default false); with the flag off the spilled sort stays on the poller. - The sink folds through the shared SpillableFlatSinkMixin. The merge sources subscribe each driver's observer to every partition spiller's source list (N-subscription fan-out, since one source merges all partitions). The parallel-merge source uses a mixed park model: the restore axis names WAIT_RESTORE, the merge-coordination axis stays NONE. - Tests: per-source block_reason lockstep oracle and observer fan-out wakeups (single- and parallel-merge), plus force-spill ON/OFF result-parity e2e. - Documents enable_spill_sort_events (en/zh/ja). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Signed-off-by: Evgeniy Shishkin <eshishki@gmail.com>
b80df57 to
bc09569
Compare
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: bc0956944e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
A partition spiller's restore/flush IO task records its error via update_spilled_task_status and emits only a source wakeup; it does not flip is_cancel/has_output_data. The merge sources' has_output() (is_partition_ready, or the parallel merger's pending/stage gates) never observed it, so on the event scheduler the source would re-park WAIT_RESTORE after the error's source wakeup and sleep until query timeout instead of propagating the error. Add SortContext::spiller_task_status() -- the first non-OK task_status() across the N partition spillers -- and consult it in both merge sources' has_output() (report ready) and pull_chunk() (RETURN_IF_ERROR). This mirrors the single-spiller agg/NLJ sources' RETURN_TRUE_IF_SPILL_TASK_ERROR + task_status() pattern, but the sort source merges N partitions so the scan and the reused Status live in one helper. - Tests: the lockstep transcription gains a spiller_task_error axis asserting an error makes the source runnable (has_output() true, block_reason() NONE, never a silent WAIT_RESTORE park); the observer test asserts the recorded error is observable on a bare partition spiller and the SortContext-style scan surfaces it while the wakeup stays on the source list. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Signed-off-by: Evgeniy Shishkin <eshishki@gmail.com>
[FE Incremental Coverage Report]✅ pass : 0 / 0 (0%) |
[Java-Extensions Incremental Coverage Report]✅ pass : 0 / 0 (0%) |
[BE Incremental Coverage Report]✅ pass : 31 / 33 (93.94%) file detail
|
Signed-off-by: Evgeniy Shishkin <eshishki@gmail.com> Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Signed-off-by: Oliver Layer <o.layer@celonis.com>
Why I'm doing:
Spillable sort (ORDER BY / TOP-N) blocks on spill IO but subscribes to no wakeup, so the busy-poller spin-polls it (the cost is in #74586, the shared base in #74587). This PR opts the sort into the event scheduler.
What I'm doing:
Stacked on #74587 (base).
The partition sort sink is a sink edge: it parks
OUTPUT_FULLon a full writer (WAIT_FLUSH) or a busy spill-process channel (WAIT_CHANNEL), subscribes to the spiller's sink list, and sharesSpillableFlatSinkMixin— same as the agg / join sinks.The merge sources (single-merge and parallel-merge) park
INPUT_EMPTYon a per-partition restore (WAIT_RESTORE). A sort merges all spilled partitions, so unlike the single-spiller agg source a merge source subscribes to every partition spiller's source list — one subscription per spilled partition — and any partition's restore or flush-all completion wakes it. The parallel-merge source also coordinates its merge stages through the merger's own observable, as the non-spill parallel sort already does.Gated on
enable_spill_sort_events(default false, mutable): off, the sort fragment runs on the poller as before; on, the sort drivers are woken by events instead of polled. Query results are unchanged.Part of #74586
What type of PR is this:
Does this PR entail a change in behavior?
If yes, please specify the type of change:
Checklist:
Bugfix cherry-pick branch check: