abhinav-phi opened a new pull request, #12012:
URL: https://github.com/apache/arrow-rs/pull/12012

   # Which issue does this PR close?
   
   - Closes #12002
   
   # Rationale for this change
   
   `binary_mut` and `try_binary_mut` short-circuited empty input arrays and 
returned `Ok` without calling `into_builder`, so an empty array with a shared 
buffer was reused even though the documented contract and the unary variants 
return the array back as `Err`. The issue reports the same inconsistency.
   
   # What changes are included in this PR?
   
   Remove the two undocumented `is_empty()` shortcuts in 
`arrow-arith/src/arity.rs`. Empty arrays now go through `into_builder`, so a 
shared buffer returns `Err(self)` and an unshared empty buffer still returns 
`Ok`.
   
   An empty array with a shared buffer now returns `Err(self)` instead of 
`Ok(Ok(empty))`; this is the user-visible behaviour discussed in the issue and 
may warrant the `api-change` label.
   
   # Are these changes tested?
   
   Added `test_binary_mut_empty_shared_buffer` covering both functions with 
shared and unshared empty inputs.
   
   - Focused: `cargo test -p arrow-arith test_binary_mut_empty_shared_buffer` 
passes.
   - Full crate: `cargo test -p arrow-arith` -> 258 unit tests and 16 doc tests 
pass.
   - `cargo fmt --all -- --check` clean.
   - `cargo clippy --workspace --all-targets --all-features -- -D warnings` 
clean.
   
   AI assistance: yes. The change was reviewed and tested by the submitter.
   


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