Shockp opened a new pull request, #49848:
URL: https://github.com/apache/arrow/pull/49848
### Rationale for this change
In Arrow, null bitmaps are optional and represented by `nullptr` when a
column contains no nulls. Previously, conjoining two optional bitmaps required
downstream code to manually handle the `nullptr` checks and memory allocations.
This change centralizes that logic into a single, highly optimized utility
function.
### What changes are included in this PR?
* Added `OptionalBitmapAnd` to `cpp/src/arrow/util/bitmap_ops.h` and
`bitmap_ops.cc`.
* The implementation safely handles the four possible memory permutations
with minimal allocations:
1. Both buffers `nullptr`: Returns `nullptr`.
2. Left is `nullptr`: Returns a copy of the right buffer.
3. Right is `nullptr`: Returns a copy of the left buffer.
4. Both valid: Defers to the low-level `BitmapAnd` function.
### Are these changes tested?
Yes. I added a new test case (`OptionalBitmapAnd`) to
`cpp/src/arrow/util/bitmap_test.cc` that explicitly verifies the correct buffer
allocation and bitwise output for all four memory states.
### Are there any user-facing changes?
No. This simply exposes a new C++ utility for internal development.
Closes #45819
--
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]