Repository navigation
Cherry-pick apache/datafusion#24697: use group clustering terminology - #205
Open
Tristan1900 wants to merge 1 commit into
Conversation
Tristan1900
force-pushed
the
wenqi.mou/cherry-pick/apache-pr-24697-20261111
branch
from
November 11, 2026 23:00
f8bf1e5 to
95fe494
Compare
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## wenqi.mou/cherry-pick/apache-pr-24737-20261111 #205 +/- ##
==================================================================================
- Coverage 81.23% 81.23% -0.01%
==================================================================================
Files 1111 1111
Lines 389136 389178 +42
Branches 389136 389178 +42
==================================================================================
+ Hits 316107 316135 +28
- Misses 54346 54358 +12
- Partials 18683 18685 +2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Tristan1900
marked this pull request as ready for review
November 12, 2026 18:23
Tristan1900
force-pushed
the
wenqi.mou/cherry-pick/apache-pr-24697-20261111
branch
3 times, most recently
from
November 12, 2026 20:13
f77118c to
1928de0
Compare
This comment has been minimized.
This comment has been minimized.
geoffreyclaude
approved these changes
Nov 16, 2026
…ache#24697) ## Which issue does this PR relate to? - Part of apache#24438. - Builds on the baseline test in apache#24737 (merged). ## Rationale for this change Aggregate execution currently uses `InputOrderMode` to select execution paths and recognize completed groups. A group can be completed incrementally when its rows form one contiguous run: once the run ends, that group cannot appear again in the same input partition. Sorted input supplies this guarantee, and unsorted input can supply it too: ```text AAABBBCCCC -> sorted; groups can be completed incrementally CCCAAABBB -> unsorted; groups can still be completed incrementally ``` This PR describes the input's _**clustering**_ guarantee with `GroupClusteringMode` and uses clustering terminology throughout the aggregate execution machinery. Aggregate construction derives the mode directly from the existing ordering analysis. The follow-up in apache#24497 will also derive it from grouped equivalence properties. ## What changes are included in this PR? - Replace the aggregate's `InputOrderMode` field with `GroupClusteringMode::{None, Partial, Full}`: - `None`: Groups have no apparent clustering guarantee. - `Partial(indices)`: rows are contiguous on a subset of grouping expressions; a change in that tuple completes all groups in the preceding run. - `Full`: rows are contiguous on the complete grouping tuple; a change in that tuple completes the preceding group. - Rename the stateful `GroupOrdering` tracker and its `Partial` and `Full` implementations to `GroupClustering`, `GroupClusteringPartial`, and `GroupClusteringFull`. - Rename the ordered aggregate streams, shared table, and adjacent-key group-values implementation to use clustered terminology, - Preserve actual sort expressions and options through equivalence properties and input-ordering requirements. - Display `group_clustering_mode` in aggregate plans and document the public API migration in the DataFusion 56 upgrade guide. ## Stack 1. [apache#24737 — test: cover unsorted contiguous groups in one partition](apache#24737) (merged) 2. [apache#24697 — refactor: use group clustering terminology in aggregate execution](apache#24697) ← **this PR** 3. [apache#24698 — feat: add Grouped equivalence properties](apache#24698) 4. [apache#24497 — feat: stream aggregates over grouped input](apache#24497) ## Are there any user-facing changes? Yes. This PR changes public Rust APIs: - `AggregateExec::input_order_mode()` is replaced by `AggregateExec::group_clustering_mode()`, returning the public `GroupClusteringMode` enum. - `AggregateExec::compute_properties` accepts `&GroupClusteringMode` in place of `&InputOrderMode`. - The public `GroupOrdering`, `GroupOrderingPartial`, and `GroupOrderingFull` types in `aggregates::order` are renamed to `GroupClustering`, `GroupClusteringPartial`, and `GroupClusteringFull`. - `GroupClustering::try_new` takes `&GroupClusteringMode`; `new_group_values` takes `&GroupClustering`. Aggregate plan output uses `group_clustering_mode=Full` and `group_clustering_mode=Partial(indices)` in place of `ordering_mode=Sorted` and `ordering_mode=PartiallySorted(indices)`. SQL results and aggregate execution-path selection retain their existing behavior. ## Review this layer [View this PR's diff](https://github.com/apache/datafusion/pull/24697/files) (cherry picked from commit d93699c)
erik-sargent
force-pushed
the
wenqi.mou/cherry-pick/apache-pr-24697-20261111
branch
from
November 16, 2026 18:41
1928de0 to
5247030
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
InputOrderModewithGroupClusteringModeand rename the group-completion trackers and streams.