adriangb commented on code in PR #20830:
URL: https://github.com/apache/datafusion/pull/20830#discussion_r2907975070


##########
datafusion/sql/src/expr/mod.rs:
##########
@@ -612,16 +612,24 @@ impl<S: ContextProvider> SqlToRel<'_, S> {
                     planner_context,
                 ),
                 _ => {
-                    if compare_op != BinaryOperator::Eq {
-                        plan_err!(
-                            "Unsupported AnyOp: '{compare_op}', only '=' is 
supported"
-                        )
-                    } else {
-                        let left_expr =
-                            self.sql_to_expr(*left, schema, planner_context)?;
-                        let right_expr =
-                            self.sql_to_expr(*right, schema, planner_context)?;
-                        Ok(array_has(right_expr, left_expr))
+                    let left_expr = self.sql_to_expr(*left, schema, 
planner_context)?;
+                    let right_expr = self.sql_to_expr(*right, schema, 
planner_context)?;
+                    match compare_op {
+                        BinaryOperator::Eq => Ok(array_has(right_expr, 
left_expr)),
+                        BinaryOperator::NotEq => 
Ok(array_min(right_expr.clone())
+                            .not_eq(left_expr.clone())
+                            .or(array_max(right_expr).not_eq(left_expr))),
+                        BinaryOperator::Gt => 
Ok(array_min(right_expr).lt(left_expr)),

Review Comment:
   Indeed:
   
   ```
   ❯ datafusion-cli
   DataFusion CLI v52.1.0
   > select array_min(null::int[]);
   +-----------------+
   | array_min(NULL) |
   +-----------------+
   | NULL            |
   +-----------------+
   1 row(s) fetched.
   Elapsed 0.006 seconds
   ```



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to