File tree 2 files changed +9
-8
lines changed
datafusion/optimizer/src/analyzer
2 files changed +9
-8
lines changed Original file line number Diff line number Diff line change @@ -85,11 +85,6 @@ impl AnalyzerRule for ApplyFunctionRewrites {
85
85
}
86
86
87
87
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
-
93
88
plan. transform_up_with_subqueries ( |plan| self . rewrite_plan ( plan, options) )
94
89
. map ( |res| res. data )
95
90
}
Original file line number Diff line number Diff line change @@ -136,9 +136,15 @@ impl Analyzer {
136
136
// Note this is run before all other rules since it rewrites based on
137
137
// the argument types (List or Scalar), and TypeCoercion may cast the
138
138
// argument types from Scalar to List.
139
- let expr_to_function: Arc < dyn AnalyzerRule + Send + Sync > =
140
- Arc :: new ( ApplyFunctionRewrites :: new ( self . function_rewrites . clone ( ) ) ) ;
141
- let rules = std:: iter:: once ( & expr_to_function) . chain ( self . rules . iter ( ) ) ;
139
+ let expr_to_function: Option < Arc < dyn AnalyzerRule + Send + Sync > > =
140
+ if self . function_rewrites . is_empty ( ) {
141
+ None
142
+ } else {
143
+ Some ( Arc :: new ( ApplyFunctionRewrites :: new (
144
+ self . function_rewrites . clone ( ) ,
145
+ ) ) )
146
+ } ;
147
+ let rules = expr_to_function. iter ( ) . chain ( self . rules . iter ( ) ) ;
142
148
143
149
// TODO add common rule executor for Analyzer and Optimizer
144
150
for rule in rules {
You can’t perform that action at this time.
0 commit comments