Skip to content

Commit

Permalink
Consolidate ConstantFolding and SimplifyExpression (#1375)
Browse files Browse the repository at this point in the history
* Consolidate `ConstantFolding` and `SimplifyExpression`

* Update simplify tests

* simplify before other optimizations
  • Loading branch information
alamb authored Dec 2, 2021
1 parent 0338b73 commit e73a7a0
Show file tree
Hide file tree
Showing 4 changed files with 450 additions and 575 deletions.
6 changes: 3 additions & 3 deletions datafusion/src/execution/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ use crate::logical_plan::{
LogicalPlanBuilder, UNNAMED_TABLE,
};
use crate::optimizer::common_subexpr_eliminate::CommonSubexprEliminate;
use crate::optimizer::constant_folding::ConstantFolding;
use crate::optimizer::filter_push_down::FilterPushDown;
use crate::optimizer::limit_push_down::LimitPushDown;
use crate::optimizer::optimizer::OptimizerRule;
Expand Down Expand Up @@ -896,12 +895,13 @@ impl Default for ExecutionConfig {
target_partitions: num_cpus::get(),
batch_size: 8192,
optimizers: vec![
Arc::new(ConstantFolding::new()),
// Simplify expressions first to maximize the chance
// of applying other optimizations
Arc::new(SimplifyExpressions::new()),
Arc::new(CommonSubexprEliminate::new()),
Arc::new(EliminateLimit::new()),
Arc::new(ProjectionPushDown::new()),
Arc::new(FilterPushDown::new()),
Arc::new(SimplifyExpressions::new()),
Arc::new(LimitPushDown::new()),
Arc::new(SingleDistinctToGroupBy::new()),
],
Expand Down
Loading

0 comments on commit e73a7a0

Please sign in to comment.