viirya commented on code in PR #8496:
URL: https://github.com/apache/arrow-datafusion/pull/8496#discussion_r1423031611


##########
datafusion/physical-expr/src/expressions/binary.rs:
##########
@@ -557,18 +557,16 @@ impl BinaryExpr {
         match &self.op {
             IsDistinctFrom | IsNotDistinctFrom | Lt | LtEq | Gt | GtEq | Eq | 
NotEq
             | Plus | Minus | Multiply | Divide | Modulo => unreachable!(),
-            And => {
-                if left_data_type == &DataType::Boolean {
-                    boolean_op!(&left, &right, and_kleene)
-                } else {
-                    internal_err!(
-                        "Cannot evaluate binary expression {:?} with types 
{:?} and {:?}",
-                        self.op,
-                        left.data_type(),
-                        right.data_type()
-                    )
-                }
-            }
+            And => match left_data_type {
+                DataType::Boolean => boolean_op!(&left, &right, and_kleene),
+                DataType::List(_field) => array_intersect(&[left, right]),

Review Comment:
   I am not sure if DataFusion already has some stuff to handle operator -> 
function aliasing. At least, we should parse/convert the `AND` operator to 
`array_intersect` function call at early stage, instead of silently turning to 
call `array_intersect` in binary physical operator. If we are going to support 
more aliasing operators like this, we will soon find these aliasing logic 
scatters everywhere in codebase and hard to track.



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