File tree 1 file changed +5
-3
lines changed
1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -1020,7 +1020,7 @@ impl OptimizerRule for PushDownFilter {
1020
1020
/// ```
1021
1021
fn rewrite_projection (
1022
1022
predicates : Vec < Expr > ,
1023
- projection : Projection ,
1023
+ mut projection : Projection ,
1024
1024
) -> Result < ( Transformed < LogicalPlan > , Option < Expr > ) > {
1025
1025
// A projection is filter-commutable if it do not contain volatile predicates or contain volatile
1026
1026
// predicates that are not used in the filter. However, we should re-writes all predicate expressions.
@@ -1053,11 +1053,13 @@ fn rewrite_projection(
1053
1053
// E.g. in `Filter: b\n Projection: a > 1 as b`, we can swap them, but the filter must be "a > 1"
1054
1054
let new_filter = LogicalPlan :: Filter ( Filter :: try_new (
1055
1055
replace_cols_by_name ( expr, & non_volatile_map) ?,
1056
- Arc :: clone ( & projection. input ) ,
1056
+ std :: mem :: take ( & mut projection. input ) ,
1057
1057
) ?) ;
1058
1058
1059
+ projection. input = Arc :: new ( new_filter) ;
1060
+
1059
1061
Ok ( (
1060
- insert_below ( LogicalPlan :: Projection ( projection) , new_filter ) ? ,
1062
+ Transformed :: yes ( LogicalPlan :: Projection ( projection) ) ,
1061
1063
conjunction ( keep_predicates) ,
1062
1064
) )
1063
1065
}
You can’t perform that action at this time.
0 commit comments