diff --git a/datafusion/optimizer/src/optimizer.rs b/datafusion/optimizer/src/optimizer.rs index 118ddef49b7e..08f0b3919e90 100644 --- a/datafusion/optimizer/src/optimizer.rs +++ b/datafusion/optimizer/src/optimizer.rs @@ -236,6 +236,12 @@ 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. let rules: Vec> = vec![ Arc::new(RewriteSetComparison::new()), Arc::new(OptimizeUnions::new()), diff --git a/datafusion/physical-optimizer/src/optimizer.rs b/datafusion/physical-optimizer/src/optimizer.rs index ff71c9ec6438..49225db03ac4 100644 --- a/datafusion/physical-optimizer/src/optimizer.rs +++ b/datafusion/physical-optimizer/src/optimizer.rs @@ -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> = vec![ // If there is a output requirement of the query, make sure that // this information is not lost across different rules during optimization.