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/13 10:07:49 UTC

[GitHub] [arrow-datafusion] alamb commented on a diff in pull request #2197: `case when` supports `NULL` constant

alamb commented on code in PR #2197:
URL: https://github.com/apache/arrow-datafusion/pull/2197#discussion_r849312085


##########
datafusion/physical-expr/src/expressions/case.rs:
##########
@@ -178,6 +178,13 @@ impl CaseExpr {
             let when_value = self.when_then_expr[i]
                 .0
                 .evaluate_selection(batch, &remainder)?;
+            // Treat 'NULL' as false value
+            let when_value = match when_value {
+                ColumnarValue::Scalar(value) if value.is_null() => {

Review Comment:
   This is a reasonable solution I think -- ideally we would have been able to coerce this value into a `ColumnarValue::Scalar(ScalarValue::Boolean(None))` at some earlier point.
   
   However, I think this special case is reasonable (and the test coverage is nice) so 👍  from me



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