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

   # Which issue does this PR close?
   
   - Closes #12559.
   
   # Rationale for this change
   
   `cast_view_to_byte` returns a `Result` and already computes the total value 
length. But it does not check that length against the offset limit of the 
target type. So a `Utf8View` or `BinaryView` array with more than `i32::MAX` 
value bytes panics in `GenericByteBuilder::append_value` when it is cast to 
`Utf8` or `Binary`.
   
   # What changes are included in this PR?
   
   `cast_view_to_byte` returns `ArrowError::ComputeError` when the total value 
length exceeds `TO::Offset::MAX_OFFSET`. The message matches the list casts in 
`arrow-cast/src/cast/list.rs`.
   
   # Are these changes tested?
   
   Yes. A new unit test builds `Utf8View` and `BinaryView` arrays whose views 
share one 1 MiB buffer, so the logical length passes `i32::MAX` without a 2 GiB 
allocation.
   
   # Are there any user-facing changes?
   
   The cast returns an error where it panicked before.
   


-- 
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