rluvaton opened a new pull request, #8619:
URL: https://github.com/apache/arrow-rs/pull/8619

   # Which issue does this PR close?
   
   - Closes #8618.
   
   # Rationale for this change
   
   Allowing to combine BooleanBuffers without a lot of copies and more (see 
issue)
   
   # What changes are included in this PR?
   
   Created most of `Buffer` ops that exists in `arrow-buffer/src/buffer/ops.rs` 
for `MutableBuffer` and `BooleanBufferBuilder`
   because we can't create `BitChunksMut` due to the reasons described below I 
had to port those to the mutable ops code
   
   ## Implementation notes
   
   ### Why there is a trait for `MutableOpsBufferSupportedLhs` and not getting 
`MutableBuffer` like the `Buffer` ops get `Buffer`
   Because then we wouldn't be able to do an operation (e.g. `AND`) on a subset 
(e.g. from bit 10 to bit 100) of a `BooleanBufferBuilder` because 
`BooleanBufferBuilder` does not expose `MutableBuffer` and I don't want to 
expose it as the user could then add some values that will affect the 
`BooleanBufferBuilder` length without updating the length
   
   
   ### Why there is a trait for `BufferSupportedRhs` and not getting `Buffer` 
like the `Buffer` ops get `Buffer`
   Because we want to be able to do `MutableBuffer & Buffer` and also 
`MutableBuffer & MutableBuffer`
   
   
   ### Why not creating `BitChunksMut` for `MutableBuffer` and making the code 
be like `Buffer` which is very simple ops
   At first I thought of implementing `BitChunksMut` for `MutableBuffer` like 
and implement the ops the same way that it was implemented for Buffer but saw 
that it was impossible as:
   1. I might get a bit offset to do the op from that is between 2 `u64` and I 
can't get a reference for that
   2. We read each `u64` and convert them to little endian as bit-packed 
buffers are stored starting with the least-significant byte first.
   3. can't get mutable value for the remainder of the bytes (`len % 64`)
   
   # Are these changes tested?
   
   Yes, although I did not run them on big endian machine
   
   # Are there any user-facing changes?
   
   Yes, new functions which are documented


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