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/06/29 22:26:17 UTC

[GitHub] [arrow-datafusion] alamb opened a new pull request, #2815: Fix ScalarValue::isNull calculation

alamb opened a new pull request, #2815:
URL: https://github.com/apache/arrow-datafusion/pull/2815

   # Which issue does this PR close?
   
   Part of https://github.com/apache/arrow-datafusion/pull/2778
   
    # Rationale for this change
   
   https://github.com/apache/arrow-rs/issues/1888 (added in `arrow 17.0.0`) added validation to `RecordBatch` if the schema's declared nullability is different than its actual nullability it throws a runtime error. 
   
   # What changes are included in this PR?
   Correct `ScalarValue::isNull`
   
   There are no additional tests in this PR -- they are covered in https://github.com/apache/arrow-datafusion/pull/2778
   
   # Are there any user-facing changes?
   More accurate schema calculations


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


[GitHub] [arrow-datafusion] liukun4515 merged pull request #2815: Fix `ScalarValue::isNull` calculation

Posted by GitBox <gi...@apache.org>.
liukun4515 merged PR #2815:
URL: https://github.com/apache/arrow-datafusion/pull/2815


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


[GitHub] [arrow-datafusion] alamb commented on a diff in pull request #2815: Fix `ScalarValue::isNull` calculation

Posted by GitBox <gi...@apache.org>.
alamb commented on code in PR #2815:
URL: https://github.com/apache/arrow-datafusion/pull/2815#discussion_r910460596


##########
datafusion/common/src/scalar.rs:
##########
@@ -625,32 +625,36 @@ impl ScalarValue {
 
     /// whether this value is null or not.
     pub fn is_null(&self) -> bool {
-        matches!(
-            *self,
-            ScalarValue::Null

Review Comment:
   You can see there are several types that are not covered (`ScalarValue::Binary` was what triggered the specific error I investiated). However, there was similar issues for other variants such as `Interval`, etc
   
   I have changed the code to use a `match` so if new variants of `ScalarValue` are added, this list will also need to be updated. 



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


[GitHub] [arrow-datafusion] alamb commented on a diff in pull request #2815: Fix `ScalarValue::isNull` calculation

Posted by GitBox <gi...@apache.org>.
alamb commented on code in PR #2815:
URL: https://github.com/apache/arrow-datafusion/pull/2815#discussion_r910460596


##########
datafusion/common/src/scalar.rs:
##########
@@ -625,32 +625,36 @@ impl ScalarValue {
 
     /// whether this value is null or not.
     pub fn is_null(&self) -> bool {
-        matches!(
-            *self,
-            ScalarValue::Null

Review Comment:
   You can see there are several types that are not covered (`ScalarValue::Binary` was what triggered an error). However, there was similar issues for `Interval`, etc
   
   I have changed the code to use a `match` so if new variants of `ScalarValue` are added, this list will also need to be updated. 



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