alamb opened a new pull request, #9707: URL: https://github.com/apache/arrow-rs/pull/9707
# Which issue does this PR close? - Closes https://github.com/apache/arrow-rs/issues/8808 # Rationale for this change Inspired by matt in https://github.com/apache/arrow-rs/pull/9692/changes I wanted to add some helper methods to the PrimitiveArray to make it easier to modify in place when possible, and clone when not possible. # What changes are included in this PR? Add the equivalent for primitive_array: - bitwise_unary_mut_or_clone(self, op) -> Self More specifically, this adds `PrimitiveArray::unary_mut_or_clone`, `PrimitiveArray::try_unary_mut_or_clone`, `PrimitiveArray::binary_mut_or_clone`, and `PrimitiveArray::try_binary_mut_or_clone`, along with doc examples and pointer-reuse tests. It also factors `arrow::compute::binary` through the shared `PrimitiveArray` binary implementation. # Are these changes tested? Yes. I ran: - `cargo test -p arrow-array` - `cargo test -p arrow-array --doc` - `cargo test -p arrow-arith` - `cargo llvm-cov --html test -p arrow-array` The new tests check both logical results and whether buffers are reused or reallocated using the same `PointerInfo` approach added for `BooleanArray`. # Are there any user-facing changes? Yes. `PrimitiveArray` now has new public helper APIs for in-place mutation with an allocating fallback when the array is shared: - `unary_mut_or_clone` - `try_unary_mut_or_clone` - `binary_mut_or_clone` - `try_binary_mut_or_clone` -- 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]
