Skip to content

fix: ignore constant aggregate completion boundaries - #25019

Open
yashrb24 wants to merge 1 commit into
apache:mainfrom
yashrb24:fix/ignore-constant-group-completion
Open

fix: ignore constant aggregate completion boundaries#25019
yashrb24 wants to merge 1 commit into
apache:mainfrom
yashrb24:fix/ignore-constant-group-completion

Conversation

@yashrb24

@yashrb24 yashrb24 commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

Which issue does this PR close?

Rationale for this change

A grouping column with one fixed value never changes, so it cannot tell aggregation that an earlier group is complete.
Currently the logic uses such columns when choosing how aggregation processes its input. This can select the ordered path even when the remaining grouping columns are not ordered.

What changes are included in this PR?

  • Ignore fixed grouping columns when deciding when groups can be completed.
  • Preserve ordered aggregation when all grouping columns that can change are ordered.
  • Update relevant plans

What is the testing strategy for this PR?

Added tests for a grouping column fixed by a filter. The tests fail without the fix.

Are there any user-facing changes?

No query results or public APIs change. DataFusion now chooses the appropriate aggregation path for fixed grouping columns.

@github-actions github-actions Bot added core Core DataFusion crate sqllogictest SQL Logic Tests (.slt) physical-plan Changes to the physical-plan crate labels Sep 7, 2026
@yashrb24

yashrb24 commented Sep 7, 2026

Copy link
Copy Markdown
Contributor Author

Since #24697 is making the broader fix for this problem, we can possibly have it fixed in that PR instead of here

@yashrb24
yashrb24 marked this pull request as ready for review September 7, 2026 12:08
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 82.92683% with 14 lines in your changes missing coverage. Please review.
✅ Project coverage is 81.69%. Comparing base (46bbf0d) to head (037c8cf).
⚠️ Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
datafusion/physical-plan/src/aggregates/mod.rs 82.92% 2 Missing and 12 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #25019      +/-   ##
==========================================
- Coverage   81.70%   81.69%   -0.01%     
==========================================
  Files        1127     1127              
  Lines      416001   416081      +80     
  Branches   416001   416081      +80     
==========================================
+ Hits       339902   339937      +35     
- Misses      56125    56153      +28     
- Partials    19974    19991      +17     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core Core DataFusion crate physical-plan Changes to the physical-plan crate sqllogictest SQL Logic Tests (.slt)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

A fixed GROUP BY column is incorrectly used to decide when groups are complete

2 participants