Skip to content

refactor(hash-aggr): migrate ordered single aggregation - #24259

Open
2010YOUY01 wants to merge 1 commit into
apache:mainfrom
2010YOUY01:split-aggr-01-ordered-single
Open

refactor(hash-aggr): migrate ordered single aggregation#24259
2010YOUY01 wants to merge 1 commit into
apache:mainfrom
2010YOUY01:split-aggr-01-ordered-single

Conversation

@2010YOUY01

Copy link
Copy Markdown
Contributor

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.rs

What 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` path
  • datafusion/physical-plan/src/aggregates/ordered_single_stream.rs: main implementation. Overview is at the comments for OrderedSingleAggregateStream, and the entry point for execution state machine is at poll_next()

Are these changes tested?

Existing tests. I have verified the test line coverage from llvm-cov

Are there any user-facing changes?

No

@github-actions github-actions Bot added the physical-plan Changes to the physical-plan crate label Aug 11, 2026
@2010YOUY01 2010YOUY01 changed the title refactor: migrate ordered single aggregation refactor(hash-aggr): migrate ordered single aggregation Aug 11, 2026
}

/// Merges every sorted run and finalizes it through the fully ordered path.
fn into_replay_stream(

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This step is mostly similar to the spilling paths of other aggregation modes. We should extract the common logic later.

&mut self,
evaluated_batch: &EvaluatedAggregateBatch,
is_final: bool,
aggregate_fn: AggregateBatchFn,

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here is the key change for this file, just a clean-up to make it easier to be reused by different aggregation modes.

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 86.86515% with 75 lines in your changes missing coverage. Please review.
✅ Project coverage is 81.00%. Comparing base (634f0b3) to head (da5eeb6).
⚠️ Report is 42 commits behind head on main.

Files with missing lines Patch % Lines
...sical-plan/src/aggregates/ordered_single_stream.rs 86.74% 49 Missing and 10 partials ⚠️
datafusion/physical-plan/src/aggregates/mod.rs 84.41% 4 Missing and 8 partials ⚠️
.../aggregates/aggregate_hash_table/common_ordered.rs 60.00% 0 Missing and 2 partials ⚠️
...gates/aggregate_hash_table/ordered_single_table.rs 94.44% 0 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #24259      +/-   ##
==========================================
- Coverage   81.06%   81.00%   -0.06%     
==========================================
  Files        1107     1108       +1     
  Lines      382191   384599    +2408     
  Branches   382191   384599    +2408     
==========================================
+ Hits       309805   311533    +1728     
- Misses      54083    54709     +626     
- Partials    18303    18357      +54     

☔ 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

physical-plan Changes to the physical-plan crate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants