apache / apache/arrow

[C++] "replace_with_mask" kernel produces invalid result (wrong validity bitmap) when array is a boolean ChunkedArray

Open
#34,634 5 comments 0 reactions 0 assignees View on GitHub
Component: Python Type: bug
Dominant language
C++
Stars
17.1k
Forks
4.3k
Avg merge
3d 18h
Merged PRs (30d)
91

Description

### Describe the bug, including details regarding any error messages, version, and platform.

Passing a boolean `ChunkedArray` to `pc.replace_with_mask` seems to produce an invalid result. Replacing the `ChunkedArray` with a regular `Array` seems to work fine. Other types seem to work fine with `ChunkedArray`. The invalid result appears that it may be specific to the boolean type.

```
import pyarrow as pa
import pyarrow.compute as pc

arr = pa.chunked_array([[True, True]])
mask = pa.array([False, True])
replacements = pa.array([False, False])

pc.replace_with_mask(arr, mask, replacements)
```

output:
```

[

]
```

### Component(s)

Python

Contributor guide

Open the contributing guide

Research direction

Run the Python reproducer for pc.replace_with_mask with the boolean ChunkedArray, mask, and replacements shown in the issue. Trace the implementation behind that entry point, focusing on validity-buffer handling for boolean chunks; done means the call returns a valid result without the reported undersized-buffer error.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, python
Domain
data-engineering
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.