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

   # Which issue does this PR close?
   
   * Part of https://github.com/apache/arrow-rs/issues/10553
   * Follows the `MutableBufferError` precedent from 
https://github.com/apache/arrow-rs/pull/10317
   
   # Rationale for this change
   
   `OffsetBuffer::<i32>::from_lengths` panics once the lengths add up to more 
than 2 GiB, which is a data-volume failure, not a programming mistake: a user 
that logs a big enough blob crashes the process. The other overflow panics in 
`arrow-buffer` are the same story.
   
   `arrow-buffer` does not depend on `arrow-schema`, so it has no `ArrowError`. 
It does have per-concern error enums (`MutableBufferError`, `ParseI256Error`), 
so this adds one more in that style.
   
   # What changes are included in this PR?
   
   A small `OverflowError` (`Copy`, no allocation, `Display` is `"{what} 
overflow"`), and a `try_` variant for each function that panics on overflow:
   
   * `OffsetBuffer::{try_new_zeroed, try_from_lengths, 
try_from_repeated_length}`
   * `OffsetBufferBuilder::{try_push_length, try_finish, try_finish_cloned}`
   * `NullBuffer::try_expand`
   
   The panicking versions delegate to the fallible ones and re-panic with the 
error's `Display`, so their panic messages are unchanged.
   
   `try_push_length` leaves the builder unchanged when it fails.
   
   # Are these changes tested?
   
   Yes, new tests for the error paths. The existing `should_panic` tests are 
untouched and still pass, which is what pins the panic messages.
   
   # Are there any user-facing changes?
   
   New public API only, no breaking changes.


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