refactor(hash-aggr): migrate ordered single aggregation - #24259
Conversation
| } | ||
|
|
||
| /// Merges every sorted run and finalizes it through the fully ordered path. | ||
| fn into_replay_stream( |
There was a problem hiding this comment.
This step is mostly similar to the spilling paths of other aggregation modes. We should extract the common logic later.
There was a problem hiding this comment.
maybe worth a ticket to track
| &mut self, | ||
| evaluated_batch: &EvaluatedAggregateBatch, | ||
| is_final: bool, | ||
| aggregate_fn: AggregateBatchFn, |
There was a problem hiding this comment.
here is the key change for this file, just a clean-up to make it easier to be reused by different aggregation modes.
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #24259 +/- ##
==========================================
+ Coverage 81.06% 81.13% +0.07%
==========================================
Files 1107 1112 +5
Lines 382191 386685 +4494
Branches 382191 386685 +4494
==========================================
+ Hits 309805 313741 +3936
- Misses 54083 54464 +381
- Partials 18303 18480 +177 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
alamb
left a comment
There was a problem hiding this comment.
looks great to me -- thank you @2010YOUY01
| )?)); | ||
| } | ||
|
|
||
| if self.should_use_ordered_single_aggregate_stream(context) { |
There was a problem hiding this comment.
FWIW while I like the explicit name of these methods I do wonder if the difference between them might be clearer if there was one giant match statement (rather than a bunch of if ... chains)
There was a problem hiding this comment.
For example the only difference between should_use_single_hash_stream and should_use_ordered_single_aggregate_stream seems to be the condition
&& self.input_order_mode != InputOrderMode::Linear🤔
There was a problem hiding this comment.
This is a good point, I've noticed it also. This entire code block can likely be simplified somehow to be more understandable.
I've opened a issue #24318, and I'll try to do it after the refactor is done.
| } | ||
|
|
||
| /// Merges every sorted run and finalizes it through the fully ordered path. | ||
| fn into_replay_stream( |
There was a problem hiding this comment.
maybe worth a ticket to track
|
Thanks for the review @alamb |
Which issue does this PR close?
part of #22710
Rationale for this change
Migrate ordered single aggregation path.
For the background of the refactor, see EPIC issue for details
For the overview of the refactored path, see comments at the top of
datafusion/physical-plan/src/aggregates/ordered_single_stream.rsWhat changes are included in this PR?
datafusion/physical-plan/src/aggregates/mod.rs: physical planning changes that route the applicable execution to the 'ordered-single-aggregate` pathdatafusion/physical-plan/src/aggregates/ordered_single_stream.rs: main implementation. Overview is at the comments forOrderedSingleAggregateStream, and the entry point for execution state machine is atpoll_next()Are these changes tested?
Existing tests. I have verified the test line coverage from
llvm-covAre there any user-facing changes?
No