Skip to content

Commit

Permalink
rm clone (#11532)
Browse files Browse the repository at this point in the history
Signed-off-by: jayzhan211 <[email protected]>
  • Loading branch information
jayzhan211 committed Jul 18, 2024
1 parent b685e2d commit 4dd8532
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions datafusion/optimizer/src/push_down_filter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1020,7 +1020,7 @@ impl OptimizerRule for PushDownFilter {
/// ```
fn rewrite_projection(
predicates: Vec<Expr>,
projection: Projection,
mut projection: Projection,
) -> Result<(Transformed<LogicalPlan>, Option<Expr>)> {
// A projection is filter-commutable if it do not contain volatile predicates or contain volatile
// predicates that are not used in the filter. However, we should re-writes all predicate expressions.
Expand Down Expand Up @@ -1053,11 +1053,13 @@ fn rewrite_projection(
// E.g. in `Filter: b\n Projection: a > 1 as b`, we can swap them, but the filter must be "a > 1"
let new_filter = LogicalPlan::Filter(Filter::try_new(
replace_cols_by_name(expr, &non_volatile_map)?,
Arc::clone(&projection.input),
std::mem::take(&mut projection.input),
)?);

projection.input = Arc::new(new_filter);

Ok((
insert_below(LogicalPlan::Projection(projection), new_filter)?,
Transformed::yes(LogicalPlan::Projection(projection)),
conjunction(keep_predicates),
))
}
Expand Down

0 comments on commit 4dd8532

Please sign in to comment.