Repository navigation
fix(arrow-data): allow full dictionary key range when concatenating - #10323
Merged
Jefffrey merged 1 commit intoJul 15, 2026
Merged
Conversation
Rich-T-kid
approved these changes
Jul 12, 2026
Rich-T-kid
left a comment
Contributor
There was a problem hiding this comment.
LGTM
It may be worth adding test to cover other key types.
| // `max` is the merged dictionary length; the largest key index is | ||
| // `max - 1`, so the key type only needs to hold `max - 1` (e.g. 256 | ||
| // values use keys 0..=255, which fit in u8). | ||
| let _: $dt = max.saturating_sub(1).try_into().ok()?; |
Concatenating dictionary arrays whose merged dictionary length exactly equals the key type's max value + 1 (e.g. 256 values with u8 keys) panicked with DictionaryKeyOverflowError. The largest key index is length - 1, so check that instead of the length. Closes apache#9366.
raphaelroshan
force-pushed
the
fix/dict-concat-key-overflow-9366
branch
from
July 13, 2026 03:48
e2fe6a1 to
dc8f1e5
Compare
Jefffrey
approved these changes
Jul 14, 2026
Contributor
|
thanks @raphaelroshan & @Rich-T-kid |
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 #9366.
Rationale for this change
Concatenating dictionary arrays whose merged dictionary length is exactly the key type's maximum value + 1 (e.g. 256 distinct values with
u8keys) panics withDictionaryKeyOverflowError. The largest key index islength - 1, so 256 values use keys0..=255, which fit inu8— the overflow check was off by one.What changes are included in this PR?
build_extend_dictionarynow checks that the key type can holdmax - 1(the largest index) rather thanmax(the length).Are these changes tested?
Yes — added
test_dict_overflow_9366, which concatenates twoDictionary<u8, _>arrays totaling 256 values and asserts it succeeds (panics before this change).Are there any user-facing changes?
No API change; a previously-panicking concat now succeeds.