avantgardnerio commented on code in PR #2885:
URL: https://github.com/apache/arrow-datafusion/pull/2885#discussion_r926973428


##########
datafusion/optimizer/src/utils.rs:
##########
@@ -65,6 +67,41 @@ pub fn split_conjunction<'a>(predicate: &'a Expr, 
predicates: &mut Vec<&'a Expr>
     }
 }
 
+/// Recursively scans a slice of expressions for any `Or` operators
+///
+/// # Arguments
+///
+/// * `predicates` - the expressions to scan
+///
+/// # Return value
+///
+/// True if an `Or` operator was found
+pub fn has_disjunction(predicates: &[&Expr]) -> bool {
+    for predicate in predicates.iter() {
+        match predicate {
+            Expr::BinaryExpr {
+                left: _,
+                op: Operator::Or,
+                right: _,
+            } => {
+                return true;
+            }
+            Expr::BinaryExpr { right, op: _, left } => {
+                if has_disjunction(&[&**left, &**right]) {
+                    return true;
+                }
+            }
+            Expr::Alias(expr, _) => {
+                if has_disjunction(&[&**expr]) {
+                    return true;
+                }
+            }
+            _ => {}

Review Comment:
   Resolved by latest commit.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to