You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "alamb (via GitHub)" <gi...@apache.org> on 2023/02/25 14:17:41 UTC

[GitHub] [arrow-datafusion] alamb commented on a diff in pull request #5367: Try to push down full filter before break-up

alamb commented on code in PR #5367:
URL: https://github.com/apache/arrow-datafusion/pull/5367#discussion_r1117930542


##########
datafusion/optimizer/src/push_down_filter.rs:
##########
@@ -699,30 +700,28 @@ impl OptimizerRule for PushDownFilter {
                 push_down_all_join(predicates, &filter.input, left, right, vec![])?
             }
             LogicalPlan::TableScan(scan) => {
-                let mut new_scan_filters = scan.filters.clone();
-                let mut new_predicate = vec![];
-
-                let filter_predicates =
-                    utils::split_conjunction_owned(filter.predicate.clone());
-
-                for filter_expr in &filter_predicates {
-                    let (preserve_filter_node, add_to_provider) =
-                        match scan.source.supports_filter_pushdown(filter_expr)? {
-                            TableProviderFilterPushDown::Unsupported => (true, false),
-                            TableProviderFilterPushDown::Inexact => (true, true),
-                            TableProviderFilterPushDown::Exact => (false, true),
-                        };
-                    if preserve_filter_node {
-                        new_predicate.push(filter_expr.clone());
-                    }
-                    if add_to_provider {
-                        // avoid reduplicated filter expr.
-                        if new_scan_filters.contains(filter_expr) {
-                            continue;
-                        }
-                        new_scan_filters.push(filter_expr.clone());
-                    }
-                }
+                let filter_predicates = split_conjunction_owned(filter.predicate.clone());

Review Comment:
   It unfortunate to require a clone here. I wonder if we could change the signature to take `&[&Expr]]` and use `split_conjunction`?
   
   https://docs.rs/datafusion-optimizer/18.0.0/datafusion_optimizer/utils/fn.split_conjunction.html
   
   



-- 
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-unsubscribe@arrow.apache.org

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