fix: try_binary dropped the logical nulls of run and dictionary arrays - #10748
Open
emilk wants to merge 2 commits into
Open
fix: try_binary dropped the logical nulls of run and dictionary arrays#10748emilk wants to merge 2 commits into
try_binary dropped the logical nulls of run and dictionary arrays#10748emilk wants to merge 2 commits into
Conversation
`null_count` counts physical nulls only. A `RunArray` has no null buffer
of its own, so an array whose values contain nulls took the no-nulls fast
path and produced a result with no nulls at all:
values [Some(10), None, Some(30)] + [1, 1, 1] => [11, 1, 31]
Gate the fast path on `is_nullable`, which accounts for logical nulls.
That check is allowed to be conservative, so fall back to the no-nulls
path when the union of the logical nulls turns out to be empty, instead
of unwrapping it.
Rich-T-kid
reviewed
Aug 19, 2026
Rich-T-kid
left a comment
Contributor
There was a problem hiding this comment.
I think this is related #10485
Jefffrey
reviewed
Aug 19, 2026
Contributor
|
another thing to note is |
`try_binary_mut` only takes `PrimitiveArray`, whose logical and physical nulls always coincide, so it cannot drop logical nulls the way `try_binary` did. Still, gate its fast path on `is_nullable` too, and fall back to the no-nulls path when the union of the logical nulls comes out empty, instead of unwrapping it. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Jefffrey
approved these changes
Aug 19, 2026
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?
No issue; found while reviewing #10730.
Rationale for this change
try_binaryskipped null handling whena.null_count() == 0 && b.null_count() == 0. That is a physical count. ARunArraynever has a null buffer of its own, so an array whose values contain nulls took the no-nulls fast path and silently produced a result with no nulls at all:A
DictionaryArraywith nullable values has the same problem.binaryis unaffected: it has no such fast path.What changes are included in this PR?
Gate the fast path on
is_nullable, which accounts for logical nulls. That check is allowed to be conservative, so an empty union of the logical nulls now falls back to the no-nulls path instead ofunwrapping.Are these changes tested?
Yes, a new test for a
RunArraywith nulls in its values. It fails onmain.Are there any user-facing changes?
try_binaryreturns the correct nulls for run and dictionary arrays. No API change.