feat: add narrow group-contiguous source property - #24698
Draft
xavlee wants to merge 3 commits into
Draft
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #24698 +/- ##
==========================================
+ Coverage 81.42% 81.47% +0.04%
==========================================
Files 1121 1122 +1
Lines 402142 404524 +2382
Branches 402142 404524 +2382
==========================================
+ Hits 327460 329578 +2118
- Misses 55484 55608 +124
- Partials 19198 19338 +140 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
xavlee
force-pushed
the
feat/issue-24438-group-contiguous-property
branch
from
August 26, 2026 19:20
b2ceb1a to
6bd697f
Compare
xavlee
force-pushed
the
feat/issue-24438-group-contiguous-property
branch
2 times, most recently
from
August 27, 2026 19:17
4dbd0df to
8626d7d
Compare
xavlee
force-pushed
the
feat/issue-24438-group-contiguous-property
branch
2 times, most recently
from
August 28, 2026 17:26
0399935 to
1e7d83a
Compare
xavlee
force-pushed
the
feat/issue-24438-group-contiguous-property
branch
from
August 28, 2026 19:45
1e7d83a to
72d66b3
Compare
This was referenced Aug 28, 2026
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.
Which issue does this PR relate to?
Rationale for this change
GroupCompletionModeseparates an aggregate's runtime group-completion mechanism fromInputOrderMode, but aggregate planning still needs independent evidence for completion on unsorted input. An input may beLinearbecause its group values are not ordered while still making every group complete before the next one begins.The relevant guarantee is that every distinct value of a complete expression tuple appears in a single contiguous run within each output partition. It does not require the tuple values themselves to be sorted:
This PR introduces
group_contiguous_exprsas the physical-plan assertion for that guarantee. A source advertises the complete tuple it knows to be contiguous,DataSourceExeccaches the assertion inPlanProperties, and operators propagate it when they preserve the relevant row sequence and expression mapping.ProjectionExecretains the assertion only when it can map every expression in the tuple.The final PR in the stack uses an exact match between this assertion and the aggregate grouping tuple to select
GroupCompletionMode::Fullfor aLinearinput.Property contract
group_contiguous_exprsrepresents one complete composite tuple. Within each output partition, all rows for every distinct tuple occupy at most one contiguous range. Tuple equality followsGROUP BYsemantics, and tuple values may occur in arbitrary order.This is a correctness assertion: a source declaration must describe every output stream accurately because a consumer may emit a completed group before end of input.
What changes are included in this PR?
The assertion follows this lifecycle:
DataSource::group_contiguous_exprsdeclares the complete tuple; the empty vector represents no assertion.DataSourceExecstores the declaration in itsPlanProperties.PlanPropertiesowns the cached tuple and exposes a builder and accessor throughExecutionPlanProperties.ProjectionExecuses all-or-nothing tuple mapping: a complete mapping stores the projected tuple, while every incomplete mapping stores the empty assertion.CooperativeExec,BufferExec, andScalarSubqueryExecpreserve the assertion by copying the complete property cache.PlanPropertiesbegin with the empty assertion.KeeporRecompute.Stack
Are these changes tested?
Tests cover:
DataSourceExec;CooperativeExec,BufferExec, andScalarSubqueryExec;Are there any user-facing changes?
DataSourceimplementations can declare one complete group-contiguous tuple throughgroup_contiguous_exprs. Custom physical plans can attach the same assertion withPlanProperties::with_group_contiguous_exprs.Review this layer
View only this PR layer