alamb commented on code in PR #2610: URL: https://github.com/apache/arrow-datafusion/pull/2610#discussion_r880888491
########## datafusion/physical-expr/src/expressions/binary.rs: ########## @@ -701,16 +701,58 @@ macro_rules! compute_bool_op { /// LEFT is array, RIGHT is scalar value macro_rules! compute_op_scalar { ($LEFT:expr, $RIGHT:expr, $OP:ident, $DT:ident) => {{ - let ll = $LEFT - .as_any() - .downcast_ref::<$DT>() - .expect("compute_op failed to downcast array"); - // generate the scalar function name, such as lt_scalar, from the $OP parameter - // (which could have a value of lt) and the suffix _scalar - Ok(Arc::new(paste::expr! {[<$OP _scalar>]}( - &ll, - $RIGHT.try_into()?, - )?)) + match $RIGHT { Review Comment: I wonder if you could use `ScalarValue::is_null()` here rather than having to expand the macros out more https://github.com/apache/arrow-datafusion/blob/master/datafusion/common/src/scalar.rs#L627 ? ########## datafusion/expr/src/binary_rule.rs: ########## @@ -412,6 +412,15 @@ pub fn is_numeric(dt: &DataType) -> bool { } } +/// Determine if at least of one of lhs and rhs is numeric, and the other must be NULL or numeric +fn both_numeric_or_null_and_numeric(lhs_type: &DataType, rhs_type: &DataType) -> bool { Review Comment: 👍 -- 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-unsubscr...@arrow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org