chore: simplify SortPreservingMergeStream to be as textbook-like as possible#23702
chore: simplify SortPreservingMergeStream to be as textbook-like as possible#23702rluvaton wants to merge 6 commits into
Conversation
| let should_poll_next_batch_for_stream = | ||
| self.advance_cursors(winner_stream); | ||
|
|
||
| // Fast path: skip the `maybe_poll_stream` call (and its `Poll` | ||
| // plumbing) unless the winner's cursor is exhausted and needs a | ||
| // fresh batch — it is live for almost every row. | ||
| if should_poll_next_batch_for_stream { | ||
| assert!( | ||
| self.cursors[winner_stream].is_none(), | ||
| "cursor should be exhausted" | ||
| ); | ||
|
|
||
| drop(timer); | ||
| poll_fn(|cx| self.maybe_poll_stream(cx, winner_stream)).await?; | ||
| timer = elapsed_compute.timer(); | ||
| } |
There was a problem hiding this comment.
I wanted to move the poll stream inside the advance_cursors but got lifetime issues so kept like this
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #23702 +/- ##
==========================================
- Coverage 80.67% 80.67% -0.01%
==========================================
Files 1088 1088
Lines 367591 367618 +27
Branches 367591 367618 +27
==========================================
+ Hits 296563 296572 +9
- Misses 53374 53385 +11
- Partials 17654 17661 +7 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
run benchmark topk_sorted_tpch sort_tpch |
|
🤖 Benchmark running (GKE) | trigger CPU Details (lscpu)Comparing simplify-sort-preserving-merge-stream (7175283) to 67947b6 (merge-base) diff using: topk_sorted_tpch File an issue against this benchmark runner |
|
🤖 Benchmark running (GKE) | trigger CPU Details (lscpu)Comparing simplify-sort-preserving-merge-stream (7175283) to 67947b6 (merge-base) diff using: sort_tpch File an issue against this benchmark runner |
|
🤖 Benchmark completed (GKE) | trigger Instance: CPU Details (lscpu)Details
Resource Usagetopk_sorted_tpch — base (merge-base)
topk_sorted_tpch — branch
File an issue against this benchmark runner |
|
🤖 Benchmark completed (GKE) | trigger Instance: CPU Details (lscpu)Details
Resource Usagesort_tpch — base (merge-base)
sort_tpch — branch
File an issue against this benchmark runner |
Which issue does this PR close?
N/A
Rationale for this change
SortPreservingMergeStreamis a little complex, so add some guiding comments and make it as textbook-like as possibleWhat changes are included in this PR?
Added comments, reorder code
Are these changes tested?
Existing tests
Are there any user-facing changes?
No