alamb commented on code in PR #10567:
URL: https://github.com/apache/datafusion/pull/10567#discussion_r1607060754


##########
datafusion/optimizer/src/push_down_filter.rs:
##########
@@ -861,16 +861,12 @@ impl OptimizerRule for PushDownFilter {
                     .collect();
                 let new_predicate: Vec<Expr> = zip
                     .filter(|(_, res)| res != 
&TableProviderFilterPushDown::Exact)
-                    .map(|(pred, _)| (*pred).clone())
+                    .map(|(pred, _)| pred.clone())
                     .collect();
 
                 let new_scan = LogicalPlan::TableScan(TableScan {

Review Comment:
   👍  this also looks like it might save some copying



##########
datafusion/optimizer/src/push_down_filter.rs:
##########
@@ -802,11 +802,11 @@ impl OptimizerRule for PushDownFilter {
                     replace_map.insert(expr.display_name()?, expr.clone());
                 }
                 let replaced_push_predicates = push_predicates
-                    .iter()
-                    .map(|expr| replace_cols_by_name(expr.clone(), 
&replace_map))
+                    .into_iter()

Review Comment:
   this looks like one example of less cloning



##########
datafusion/optimizer/src/push_down_filter.rs:
##########
@@ -829,12 +829,12 @@ impl OptimizerRule for PushDownFilter {
             }
             LogicalPlan::Join(join) => push_down_join(join, 
Some(&filter.predicate)),
             LogicalPlan::CrossJoin(cross_join) => {
-                let predicates = 
split_conjunction_owned(filter.predicate.clone());
+                let predicates = split_conjunction_owned(filter.predicate);

Review Comment:
   likewise here we avoid an additional clone



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org
For additional commands, e-mail: github-h...@datafusion.apache.org

Reply via email to