Skip to content

Commit

Permalink
Short circuit ApplyFunctionRewrites if there are no function rewrites
Browse files Browse the repository at this point in the history
  • Loading branch information
gruuya committed Aug 1, 2024
1 parent cc6416e commit 026a784
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions datafusion/optimizer/src/analyzer/function_rewrite.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,11 @@ impl AnalyzerRule for ApplyFunctionRewrites {
}

fn analyze(&self, plan: LogicalPlan, options: &ConfigOptions) -> Result<LogicalPlan> {
if self.function_rewrites.is_empty() {
// No need to walk the plan tree since there's nothing to rewrite
return Ok(plan);
}

plan.transform_up_with_subqueries(|plan| self.rewrite_plan(plan, options))
.map(|res| res.data)
}
Expand Down

0 comments on commit 026a784

Please sign in to comment.