Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ScalarValue::isNull calculation #2815

Merged

Conversation

alamb
Copy link
Contributor

@alamb alamb commented Jun 29, 2022

Which issue does this PR close?

Part of #2778

Rationale for this change

apache/arrow-rs#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 #2778

Are there any user-facing changes?

More accurate schema calculations

@alamb alamb changed the title Fix ScalarValue::isNull calculation Fix ScalarValue::isNull calculation Jun 29, 2022
@@ -625,32 +625,36 @@ impl ScalarValue {

/// whether this value is null or not.
pub fn is_null(&self) -> bool {
matches!(
*self,
ScalarValue::Null
Copy link
Contributor Author

@alamb alamb Jun 29, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@alamb alamb mentioned this pull request Jun 29, 2022
6 tasks
@liukun4515 liukun4515 merged commit b9b4edc into apache:master Jun 30, 2022
@alamb alamb deleted the alamb/fix_scalar_value_null_calculation branch August 8, 2023 20:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants