You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "Rich-T-kid (via GitHub)" <gi...@apache.org> on 2026/08/11 17:59:12 UTC
[PR] replace MutableBuffer callsites with fallible methods [arrow-rs]
Rich-T-kid opened a new pull request, #10641:
URL: https://github.com/apache/arrow-rs/pull/10641
# Which issue does this PR close?
<!--
We generally require a GitHub issue to be filed for all bug fixes and enhancements and this helps us generate change logs for our releases. You can link an issue to this PR using the GitHub syntax.
-->
- Closes https://github.com/apache/arrow-rs/issues/9843.
- works off of #10317
# Rationale for this change
it is better to return an error and let down stream users decide how to proceed than to panic.
<!--
Why are you proposing this change? If this is already explained clearly in the issue then this section is not needed.
Explaining clearly why changes are proposed helps reviewers understand your changes and offer better suggestions for fixes.
-->
# What changes are included in this PR?
updates all call sites in the project to use the fallible alternative to `mutableBuffer` methods.
<!--
There is no need to duplicate the description in the issue here but it is sometimes worth providing a summary of the individual changes in this PR.
-->
# Are these changes tested?
n/a behavior hasn't changed
<!--
We typically require tests for all PRs in order to:
1. Prevent the code from being accidentally broken by subsequent changes
2. Serve as another way to document the expected behavior of the code
If tests are not included in your PR, please explain why (for example, are they covered by existing tests)?
If this PR claims a performance improvement, please include evidence such as benchmark results.
-->
# Are there any user-facing changes?
no public methods we changed in this PR
<!--
If there are user-facing changes then we may require documentation to be updated before approving the PR.
If there are any breaking changes to public APIs, please call them out.
-->
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] replace MutableBuffer callsites with fallible methods [arrow-rs]
Posted by "Jefffrey (via GitHub)" <gi...@apache.org>.
Jefffrey commented on code in PR #10641:
URL: https://github.com/apache/arrow-rs/pull/10641#discussion_r3764620003
##########
arrow-array/src/array/fixed_size_binary_array.rs:
##########
@@ -457,20 +457,28 @@ impl FixedSizeBinaryArray {
// sufficient capacity in the underlying mutable buffer for
// the data.
if let Some(capacity) = iter_size_hint.checked_mul(len) {
- buffer.reserve(capacity);
+ buffer
+ .try_reserve(capacity)
+ .map_err(|e| ArrowError::MemoryError(e.to_string()))?;
Review Comment:
is it worth having a into/from implementation so `?` can handle this for us? since im seeing it a lot in this diff
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] replace MutableBuffer callsites with fallible methods [arrow-rs]
Posted by "Jefffrey (via GitHub)" <gi...@apache.org>.
Jefffrey commented on code in PR #10641:
URL: https://github.com/apache/arrow-rs/pull/10641#discussion_r3771656848
##########
arrow-array/src/array/fixed_size_binary_array.rs:
##########
@@ -457,20 +457,28 @@ impl FixedSizeBinaryArray {
// sufficient capacity in the underlying mutable buffer for
// the data.
if let Some(capacity) = iter_size_hint.checked_mul(len) {
- buffer.reserve(capacity);
+ buffer
+ .try_reserve(capacity)
+ .map_err(|e| ArrowError::MemoryError(e.to_string()))?;
Review Comment:
oh thats a bugger 🤔
maybe better off without this then, to avoid this dependency just for this
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] replace MutableBuffer callsites with fallible methods [arrow-rs]
Posted by "Jefffrey (via GitHub)" <gi...@apache.org>.
Jefffrey commented on PR #10641:
URL: https://github.com/apache/arrow-rs/pull/10641#issuecomment-5291086310
thanks @Rich-T-kid
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] replace MutableBuffer callsites with fallible methods [arrow-rs]
Posted by "Rich-T-kid (via GitHub)" <gi...@apache.org>.
Rich-T-kid commented on code in PR #10641:
URL: https://github.com/apache/arrow-rs/pull/10641#discussion_r3769410853
##########
arrow-array/src/array/fixed_size_binary_array.rs:
##########
@@ -457,20 +457,28 @@ impl FixedSizeBinaryArray {
// sufficient capacity in the underlying mutable buffer for
// the data.
if let Some(capacity) = iter_size_hint.checked_mul(len) {
- buffer.reserve(capacity);
+ buffer
+ .try_reserve(capacity)
+ .map_err(|e| ArrowError::MemoryError(e.to_string()))?;
Review Comment:
This would require adding a depency link between `arrow-buffer` or `arrow-schema` to implement `from<T>`
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] replace MutableBuffer callsites with fallible methods [arrow-rs]
Posted by "Rich-T-kid (via GitHub)" <gi...@apache.org>.
Rich-T-kid commented on code in PR #10641:
URL: https://github.com/apache/arrow-rs/pull/10641#discussion_r3769410853
##########
arrow-array/src/array/fixed_size_binary_array.rs:
##########
@@ -457,20 +457,28 @@ impl FixedSizeBinaryArray {
// sufficient capacity in the underlying mutable buffer for
// the data.
if let Some(capacity) = iter_size_hint.checked_mul(len) {
- buffer.reserve(capacity);
+ buffer
+ .try_reserve(capacity)
+ .map_err(|e| ArrowError::MemoryError(e.to_string()))?;
Review Comment:
This will require adding a depency link between `arrow-buffer` or `arrow-schema` to implement
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] replace MutableBuffer callsites with fallible methods [arrow-rs]
Posted by "Rich-T-kid (via GitHub)" <gi...@apache.org>.
Rich-T-kid commented on code in PR #10641:
URL: https://github.com/apache/arrow-rs/pull/10641#discussion_r3761524446
##########
arrow-select/src/zip.rs:
##########
@@ -473,10 +473,11 @@ impl<T: ByteArrayType> BytesScalarImpl<T> {
/// return an output array that has
/// `value` in all locations where predicate is true
/// `null` otherwise
+ #[allow(clippy::type_complexity)]
fn get_scalar_and_null_buffer_for_single_non_nullable(
predicate: BooleanBuffer,
value: &[u8],
- ) -> (Buffer, OffsetBuffer<T::Offset>, Option<NullBuffer>) {
+ ) -> Result<(Buffer, OffsetBuffer<T::Offset>, Option<NullBuffer>), ArrowError> {
Review Comment:
return type uses T::Offset which is a generic associated type, making a standalone type alias impossible;
adding a clippy suppress here
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] replace MutableBuffer callsites with fallible methods [arrow-rs]
Posted by "Rich-T-kid (via GitHub)" <gi...@apache.org>.
Rich-T-kid commented on code in PR #10641:
URL: https://github.com/apache/arrow-rs/pull/10641#discussion_r3769330894
##########
arrow-array/src/array/fixed_size_binary_array.rs:
##########
@@ -457,20 +457,28 @@ impl FixedSizeBinaryArray {
// sufficient capacity in the underlying mutable buffer for
// the data.
if let Some(capacity) = iter_size_hint.checked_mul(len) {
- buffer.reserve(capacity);
+ buffer
+ .try_reserve(capacity)
+ .map_err(|e| ArrowError::MemoryError(e.to_string()))?;
Review Comment:
good idea
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] replace MutableBuffer callsites with fallible methods [arrow-rs]
Posted by "Rich-T-kid (via GitHub)" <gi...@apache.org>.
Rich-T-kid commented on code in PR #10641:
URL: https://github.com/apache/arrow-rs/pull/10641#discussion_r3772204317
##########
arrow-array/src/array/fixed_size_binary_array.rs:
##########
@@ -457,20 +457,28 @@ impl FixedSizeBinaryArray {
// sufficient capacity in the underlying mutable buffer for
// the data.
if let Some(capacity) = iter_size_hint.checked_mul(len) {
- buffer.reserve(capacity);
+ buffer
+ .try_reserve(capacity)
+ .map_err(|e| ArrowError::MemoryError(e.to_string()))?;
Review Comment:
makes sense, reverted it
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] replace MutableBuffer callsites with fallible methods [arrow-rs]
Posted by "Jefffrey (via GitHub)" <gi...@apache.org>.
Jefffrey merged PR #10641:
URL: https://github.com/apache/arrow-rs/pull/10641
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org