feat: stream exact group-contiguous aggregates - #24497
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #24497 +/- ##
==========================================
+ Coverage 81.42% 81.49% +0.06%
==========================================
Files 1121 1123 +2
Lines 402142 405273 +3131
Branches 402142 405273 +3131
==========================================
+ Hits 327460 330271 +2811
- Misses 55484 55633 +149
- Partials 19198 19369 +171 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
e3b1c0a to
6718bbf
Compare
Why does it need a new property? I think this notion is designed to be covered y the existing ordering / monotonic analyses |
|
Oh, I see, somehow the external system knows the data is not sorted but is non overlapping I think this is going to be really hard to manage / ensure through the plan -- we will need to ensure that every operator properly reports if it will propagate this property or not I am not sure this is something we want to complicate datafusion with |
|
@NGA-TRAN can you help evaluate this PR for its impact and if we will be able to keep this property in tact? |
|
Hi Andrew, thanks for taking an initial look. Apologies that this is still verymuch a draft. I agree that propagating another physical property through the plan would be a little complicated. I was hoping we would narrow the
|
|
@alamb : I added a comment in the ticket
The impact of this PR is huge for telemetry use cases of AI frontiers as I described in the comment above
This property, like some properties, will be no longer available after certain operators so I think it would wok the same. I agree the propagation is a bit more complicated than usual but we work together to split this PR into smaller ones and will look into design carefully to avoid a lot of side effect. I think we would be able to make the design simpler |
c6e6b16 to
4b01e80
Compare
4b01e80 to
c3ce192
Compare
c3ce192 to
3750856
Compare
a458bf8 to
dccbf9a
Compare
26dd20f to
b909dc4
Compare
b909dc4 to
dd6d54a
Compare
dd6d54a to
58bef24
Compare
Which issue does this PR close?
Rationale for this change
Analytics over large amounts of pre-partitioned data can combine many logical runs into fewer DataFusion output partitions. A source may know that every complete grouping tuple occupies one contiguous row range even when tuple values occur in arbitrary order.
For telemetry workloads, a tuple such as
(bhandle, date_bin(timestamp))can satisfy this invariant. Streaming completed groups releases aggregate state as the input advances and produces output before end of input.What changes are included in this PR?
AggregateExecreads the cachedgroup_contiguous_exprstuple from its inputPlanPropertiesand compares it with the completeGROUP BYtuple using input equivalence properties. Matching supports equivalent expressions and tuple permutation.An exact complete-tuple match establishes
GroupCompletionMode::Full. The input retainsInputOrderMode::Linearfor arbitrary tuple order, while DataFusion's existing full group-completion tables and streams emit each completed group when the next tuple begins.For example, the following tuple order is unsorted, but every complete group occupies one contiguous run:
Stack
Are these changes tested?
Tests cover:
InputOrderMode::Linear, establishesGroupCompletionMode::Full, reportsEmissionType::Incremental, and selectsOrderedSingleAggregateStream;benefits_from_input_partitioningbehavior;date_bingrouping tuple with non-monotonic logical-run resets and correct aggregate output; andrange_sorted_time_bin_agg.sltscenario on a branch combined with feat: skip hash shuffle for date_bin/date_trunc on Range([timestamp]) #24501.Are there any user-facing changes?
Sources and custom physical plans can certify a complete group-contiguous tuple. An aggregate whose complete grouping tuple matches that assertion uses full group completion and emits completed groups incrementally within each input partition.
Review this layer
View only this PR layer