GH-51223: [C++] Fix copying sliced boolean arrays - #51240
Open
A-makarim wants to merge 1 commit into
Open
Conversation
Fixes apache#51223 Signed-off-by: Abdul Azeem Makarim <114302821+A-makarim@users.noreply.github.com>
|
|
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The boolean ArraySpan copy now correctly accounts for slice offsets and the added regression tests directly cover the reported failure modes.
Pull request overview
Fixes incorrect bit indexing when copying from sliced boolean ArraySpans by ensuring the slice offset is applied during bitmap copies, and adds regression tests covering the affected compute kernels.
Changes:
- Apply
ArraySpan::offsetto the bit index when copying boolean values viaCopyDataUtils<BooleanType>. - Add regression tests for sliced boolean inputs in
replace_with_mask,fill_null_forward, andfill_null_backward.
File summaries
| File | Description |
|---|---|
| cpp/src/arrow/compute/kernels/copy_data_internal.h | Fix boolean ArraySpan copy to include in.offset in the bit index passed to CopyBitmap. |
| cpp/src/arrow/compute/kernels/vector_replace_test.cc | Add regression tests that exercise non-byte-aligned (offset=3) sliced boolean arrays for replace_with_mask and fill-null kernels. |
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Rationale for this change
Boolean values are bit-packed. When copying values from a sliced boolean array,
the copy path did not include the array's slice offset. This caused
fill_null_forward,fill_null_backward, andreplace_with_maskto readvalues from earlier positions in the parent array.
What changes are included in this PR?
ArraySpan::offsetto the bit index when copying boolean values froman
ArraySpan.replace_with_mask,fill_null_forward, andfill_null_backward.Are these changes tested?
Yes. I ran
arrow-compute-vector-testlocally.Are there any user-facing changes?
Only a bugfix.
This PR contains a "Critical Fix".
This fixes a bug that caused compute operations on sliced boolean arrays with
a non-zero offset to produce incorrect values.