Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions datafusion/optimizer/src/optimizer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,15 @@ impl Default for Optimizer {
impl Optimizer {
/// Create a new optimizer using the recommended list of rules
pub fn new() -> Self {
// NOTEs:
// - The order of rules in this list is important, as it determines the
// order in which they are applied.
// - Adding a new rule here is expensive as it will be applied to all
// queries, and will likely increase the optimization time. Please extend
// existing rules when possible, rather than adding a new rule.
Comment thread
adriangb marked this conversation as resolved.
// If you do add a new rule considering having aggressive no-op paths
// (e.g. if the plan doesn't contain any of the nodes you are looking for
// return `Transformed::no`; only works if you control the traversal).
let rules: Vec<Arc<dyn OptimizerRule + Sync + Send>> = vec![
Arc::new(RewriteSetComparison::new()),
Arc::new(OptimizeUnions::new()),
Expand Down
6 changes: 6 additions & 0 deletions datafusion/physical-optimizer/src/optimizer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,12 @@ impl Default for PhysicalOptimizer {
impl PhysicalOptimizer {
/// Create a new optimizer using the recommended list of rules
pub fn new() -> Self {
// NOTEs:
// - The order of rules in this list is important, as it determines the
// order in which they are applied.
// - Adding a new rule here is expensive as it will be applied to all
// queries, and will likely increase the optimization time. Please extend
// existing rules when possible, rather than adding a new rule.
let rules: Vec<Arc<dyn PhysicalOptimizerRule + Send + Sync>> = vec![
// If there is a output requirement of the query, make sure that
// this information is not lost across different rules during optimization.
Expand Down