raphaelroshan opened a new pull request, #10323:
URL: https://github.com/apache/arrow-rs/pull/10323

   # 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 `u8` keys) 
panics with `DictionaryKeyOverflowError`. The largest key index is `length - 
1`, so 256 values use keys `0..=255`, which fit in `u8` — the overflow check 
was off by one.
   
   # What changes are included in this PR?
   
   `build_extend_dictionary` now checks that the key type can hold `max - 1` 
(the largest index) rather than `max` (the length).
   
   # Are these changes tested?
   
   Yes — added `test_dict_overflow_9366`, which concatenates two 
`Dictionary<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.


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to