You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2022/04/20 09:30:57 UTC

[GitHub] [arrow-datafusion] Dandandan commented on a diff in pull request #2282: Enable filter pushdown when using In_list on parquet

Dandandan commented on code in PR #2282:
URL: https://github.com/apache/arrow-datafusion/pull/2282#discussion_r853928376


##########
datafusion/core/src/physical_optimizer/pruning.rs:
##########
@@ -688,6 +688,29 @@ fn build_predicate_expression(
                 return Ok(unhandled);
             }
         }
+        Expr::InList {
+            expr,
+            list,
+            negated,
+        } => {
+            if !list.is_empty() {
+                let mut or_expr = if *negated {
+                    Expr::not_eq(*expr.clone(), list[0].clone())
+                } else {
+                    Expr::eq(*expr.clone(), list[0].clone())
+                };
+
+                for e in list.iter().skip(1) {

Review Comment:
   We could simplify the above code to something like (untested):
   
   ```rust
   
   let eq_fun = if *negated { Expr::not_eq } else { Expr::Eq };
   
   let or_expr = list.into_iter().
   map(eq_fun)
   .reduce(Expr::or);
   ```



-- 
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