feat: implement is_null method for DictionaryArray and TypedDictionar…#7608
Closed
kosiew wants to merge 1 commit intoapache:mainfrom
Closed
feat: implement is_null method for DictionaryArray and TypedDictionar…#7608kosiew wants to merge 1 commit intoapache:mainfrom
kosiew wants to merge 1 commit intoapache:mainfrom
Conversation
tustvold
requested changes
Jun 5, 2025
Contributor
There was a problem hiding this comment.
This will regress performance potentially significantly for the common case where there are no null values in the values array. Ultimately our hands are tied here, ultimately the arrow specification does not encode nullability in a manner that neatly maps to logical concepts. Array::logical_nulls is the compromise we came up with, and allows amortising the logical null computation over multiple values.
Contributor
Author
|
Thank you @tustvold for your explanation. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Which issue does this PR close?
Closes #7607.
Rationale for this change
Previously, the
is_nullmethod onDictionaryArrayonly considered nulls in the keys buffer, which could result in inaccurate null reporting when the dictionary values themselves contained nulls. This change ensures that nulls are correctly propagated by also checking the referenced value in the dictionary array.Accurately reflecting null semantics is essential for correctness in downstream operations such as filtering, joins, and aggregations.
What changes are included in this PR?
is_nullmethod inDictionaryArraythat checks both the key and its referenced value.TypedDictionaryArrayto delegate to the dictionary'sis_null.test_is_null_considers_dictionary_valuesto verify the combined null behavior in both raw and typed dictionary arrays.Are there any user-facing changes?
Yes, this changes the behavior of
is_nullforDictionaryArrayandTypedDictionaryArray. Users relying on the previous behavior (which only checked key nulls) may observe different results if dictionary values contain nulls.This aligns the behavior more closely with expected null propagation semantics but should be considered a behavioral fix that might impact some logic in downstream code.