Skip to content

Commit 4dd8532

Browse files
authored
rm clone (#11532)
Signed-off-by: jayzhan211 <[email protected]>
1 parent b685e2d commit 4dd8532

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

datafusion/optimizer/src/push_down_filter.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1020,7 +1020,7 @@ impl OptimizerRule for PushDownFilter {
10201020
/// ```
10211021
fn rewrite_projection(
10221022
predicates: Vec<Expr>,
1023-
projection: Projection,
1023+
mut projection: Projection,
10241024
) -> Result<(Transformed<LogicalPlan>, Option<Expr>)> {
10251025
// A projection is filter-commutable if it do not contain volatile predicates or contain volatile
10261026
// predicates that are not used in the filter. However, we should re-writes all predicate expressions.
@@ -1053,11 +1053,13 @@ fn rewrite_projection(
10531053
// E.g. in `Filter: b\n Projection: a > 1 as b`, we can swap them, but the filter must be "a > 1"
10541054
let new_filter = LogicalPlan::Filter(Filter::try_new(
10551055
replace_cols_by_name(expr, &non_volatile_map)?,
1056-
Arc::clone(&projection.input),
1056+
std::mem::take(&mut projection.input),
10571057
)?);
10581058

1059+
projection.input = Arc::new(new_filter);
1060+
10591061
Ok((
1060-
insert_below(LogicalPlan::Projection(projection), new_filter)?,
1062+
Transformed::yes(LogicalPlan::Projection(projection)),
10611063
conjunction(keep_predicates),
10621064
))
10631065
}

0 commit comments

Comments
 (0)