Skip to content

Commit 1600a30

Browse files
authored
Add new physical rule CombinePartialFinalAggregate (#5837)
* add CombinePartialFinalAggregate rule * Implement PartialEq for AggregateExpr * fix compile error * refine logic in the rule * add UT * resolve review comments * fix compare grouping columns
1 parent f0d544f commit 1600a30

33 files changed

Lines changed: 1068 additions & 40 deletions

datafusion/core/src/execution/context.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ use datafusion_sql::planner::object_name_to_table_reference;
110110
use uuid::Uuid;
111111

112112
// backwards compatibility
113+
use crate::physical_optimizer::combine_partial_final_agg::CombinePartialFinalAggregate;
113114
pub use datafusion_execution::config::SessionConfig;
114115
pub use datafusion_execution::TaskContext;
115116

@@ -1329,6 +1330,9 @@ impl SessionState {
13291330
// Note that one should always run this rule after running the EnforceDistribution rule
13301331
// as the latter may break local sorting requirements.
13311332
Arc::new(EnforceSorting::new()),
1333+
// The CombinePartialFinalAggregate rule should be applied after the EnforceDistribution
1334+
// and EnforceSorting rules
1335+
Arc::new(CombinePartialFinalAggregate::new()),
13321336
// The CoalesceBatches rule will not influence the distribution and ordering of the
13331337
// whole plan tree. Therefore, to avoid influencing other rules, it should run last.
13341338
Arc::new(CoalesceBatches::new()),

0 commit comments

Comments
 (0)