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/09/06 17:49:29 UTC

[GitHub] [arrow-datafusion] alamb commented on a diff in pull request #7449: Make IN expr work with multiple items

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


##########
datafusion/physical-expr/src/expressions/in_list.rs:
##########
@@ -326,12 +329,26 @@ impl PhysicalExpr for InListExpr {
     }
 
     fn evaluate(&self, batch: &RecordBatch) -> Result<ColumnarValue> {
-        let value = self.expr.evaluate(batch)?.into_array(1);
+        let value = self.expr.evaluate(batch)?;
         let r = match &self.static_filter {
-            Some(f) => f.contains(value.as_ref(), self.negated)?,
+            Some(f) => f.contains(value.into_array(1).as_ref(), self.negated)?,
             None => {
-                let list = evaluate_list(&self.list, batch)?;
-                make_set(list.as_ref())?.contains(value.as_ref(), self.negated)?
+                let value = value.into_array(batch.num_rows());
+                let found = self.list.iter().map(|expr| expr.evaluate(batch)).try_fold(

Review Comment:
   this is a very nice formulation



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