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/04/07 18:08:47 UTC

[GitHub] [arrow-datafusion] WinkerDu commented on a diff in pull request #2144: fix `not(null)` with constant `null`

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


##########
datafusion/physical-expr/src/expressions/not.rs:
##########
@@ -86,10 +86,29 @@ impl PhysicalExpr for NotExpr {
                 )))
             }
             ColumnarValue::Scalar(scalar) => {
-                let bool_value: bool = scalar.try_into()?;
-                Ok(ColumnarValue::Scalar(ScalarValue::Boolean(Some(
-                    !bool_value,
-                ))))
+                match scalar {
+                    ScalarValue::Utf8(utf8_val) => {
+                        // NOT op supports `NOT(NULL)` usage that returns `NULL` directly
+                        if utf8_val.is_none() {
+                            Ok(ColumnarValue::Scalar(ScalarValue::Utf8(None)))

Review Comment:
   @alamb OK, will fix it in follow on 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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org