Skip to content

Commit 026a784

Browse files
committed
Short circuit ApplyFunctionRewrites if there are no function rewrites
1 parent cc6416e commit 026a784

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

datafusion/optimizer/src/analyzer/function_rewrite.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,11 @@ impl AnalyzerRule for ApplyFunctionRewrites {
8585
}
8686

8787
fn analyze(&self, plan: LogicalPlan, options: &ConfigOptions) -> Result<LogicalPlan> {
88+
if self.function_rewrites.is_empty() {
89+
// No need to walk the plan tree since there's nothing to rewrite
90+
return Ok(plan);
91+
}
92+
8893
plan.transform_up_with_subqueries(|plan| self.rewrite_plan(plan, options))
8994
.map(|res| res.data)
9095
}

0 commit comments

Comments
 (0)