Skip to content

Commit

Permalink
Add new physical rule CombinePartialFinalAggregate (apache#5837)
Browse files Browse the repository at this point in the history
* add CombinePartialFinalAggregate rule

* Implement PartialEq for AggregateExpr

* fix compile error

* refine logic in the rule

* add UT

* resolve review comments

* fix compare grouping columns
  • Loading branch information
mingmwang authored and korowa committed Apr 13, 2023
1 parent d12b347 commit 8f3d4de
Show file tree
Hide file tree
Showing 33 changed files with 1,068 additions and 40 deletions.
4 changes: 4 additions & 0 deletions datafusion/core/src/execution/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ use datafusion_sql::planner::object_name_to_table_reference;
use uuid::Uuid;

// backwards compatibility
use crate::physical_optimizer::combine_partial_final_agg::CombinePartialFinalAggregate;
pub use datafusion_execution::config::SessionConfig;
pub use datafusion_execution::TaskContext;

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

0 comments on commit 8f3d4de

Please sign in to comment.