You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2022/05/10 18:02:21 UTC

[GitHub] [arrow-datafusion] WinkerDu commented on a diff in pull request #2481: Numeric, String, Boolean comparisons with literal `NULL`

WinkerDu commented on code in PR #2481:
URL: https://github.com/apache/arrow-datafusion/pull/2481#discussion_r869537683


##########
datafusion/physical-expr/src/expressions/binary.rs:
##########
@@ -657,17 +657,15 @@ macro_rules! compute_utf8_op_scalar {
 
 /// Invoke a compute kernel on a data array and a scalar value
 macro_rules! compute_utf8_op_dyn_scalar {
-    ($LEFT:expr, $RIGHT:expr, $OP:ident) => {{
+    ($LEFT:expr, $RIGHT:expr, $OP:ident, $OP_TYPE:expr) => {{
         if let Some(string_value) = $RIGHT {
             Ok(Arc::new(paste::expr! {[<$OP _dyn_utf8_scalar>]}(
                 $LEFT,
                 &string_value,
             )?))
         } else {
-            Err(DataFusionError::Internal(format!(
-                "compute_utf8_op_scalar for '{}' failed with literal 'none' value",
-                stringify!($OP),
-            )))
+            // when the $RIGHT is a NULL, generate a NULL array of $OP_TYPE
+            Ok(Arc::new(new_null_array($OP_TYPE, $LEFT.len())))

Review Comment:
   Thanks @alamb @yjshen 
   I agree this macro is just used in expression `evaluate`, maybe we can ignore it in this pr.
   I'll look into this case `NULL != column` carefully and add more cases in ut.
   Besides, I am super busy these days, I'll do it ASAP 🤟 



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