Repository navigation
Labels
enhancementNew feature/addition
Description
Is your feature request related to a problem or challenge?
when poking around investigating a separate issue i noticed some places we still use panicky versions of MutableBuffer methods even inside a fallible method, see examples of from_len_zeroed:
arrow-rs/arrow-buffer/src/buffer/offset.rs
Lines 112 to 119 in 6db3c54
| pub fn try_new_zeroed(len: usize) -> Result<Self, OverflowError> { | |
| let len_bytes = len | |
| .checked_add(1) | |
| .and_then(|o| o.checked_mul(std::mem::size_of::<O>())) | |
| .ok_or_else(|| OverflowError::new::<usize>("buffer length"))?; | |
| let buffer = MutableBuffer::from_len_zeroed(len_bytes); | |
| Ok(Self(buffer.into_buffer().into())) | |
| } |
- though this is a bit tricky since the error is
OverflowError🤔
arrow-rs/arrow-data/src/transform/mod.rs
Lines 707 to 710 in 6db3c54
| let null_buffer = use_nulls.then(|| { | |
| let null_bytes = bit_util::ceil(array_capacity, 8); | |
| MutableBuffer::from_len_zeroed(null_bytes) | |
| }); |
Describe the solution you'd like
we should replace the above with the fallible version if possible. we should also do a further audit to see where else we are using the panicky method instead of the fallible version, not only for from_len_zeroed but for other methods of mutablebuffer
Describe alternatives you've considered
No response
Additional context
No response
Metadata
Metadata
Assignees
Labels
enhancementNew feature/addition
Activity
Jefffrey commentedon Oct 25, 2026
fyi @Rich-T-kid
Rich-T-kid commentedon Oct 25, 2026
yeah I can look into this. should be easy enough to have ai do a search and replace
Rich-T-kid commentedon Oct 25, 2026
take
Use fallible MutableBuffer methods in fallible APIs (apache#11912)
Use fallible MutableBuffer methods in fallible APIs (apache#11973)