alamb commented on code in PR #8594:
URL: https://github.com/apache/arrow-rs/pull/8594#discussion_r2430357202
##########
arrow-array/src/builder/generic_bytes_view_builder.rs:
##########
@@ -356,17 +371,41 @@ impl<T: ByteViewType + ?Sized> GenericByteViewBuilder<T> {
let to_reserve = v.len().max(self.block_size.next_size() as usize);
self.in_progress.reserve(to_reserve);
};
- let offset = self.in_progress.len() as u32;
+ let offset: u32 = self.in_progress.len().try_into().map_err(|_| {
+ ArrowError::InvalidArgumentError(format!(
+ "In-progress buffer length {} exceeds u32::MAX",
Review Comment:
I think a new buffer would be allocated in the line immediately above this.
Maybe we should do a checked add in `let required_cap =
self.in_progress.len() + v.len();` 🤔
To error here, we would need a `usize` that doesn't fit into a u32.. I think
all platforms we care about have `usize` that is at least `u32` (aka 32-bit
architectures)
--
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]