fenfeng9 commented on PR #49908:
URL: https://github.com/apache/arrow/pull/49908#issuecomment-4379552496
The original behavior is:
#### Reproduce
```python
import pyarrow as pa
import pyarrow.compute as pc
array = pa.array([1, 1, None, None, None, 2, 2, 2, None, 3])
encoded = pc.run_end_encode(array)
# Logical slice: [None, None, 2, 2, 2, None].
slice_plain = array.slice(3, 6)
slice_encoded = encoded.slice(3, 6)
print("pyarrow:", pa.__version__)
print()
print(f"{'case':<12} {'only_valid':>10} {'only_null':>10} {'all':>6}")
for name, value in [
("plain", array),
("ree", encoded),
("slice plain", slice_plain),
("slice ree", slice_encoded),
]:
print(
f"{name:<12} "
f"{pc.count(value, mode='only_valid').as_py():>10} "
f"{pc.count(value, mode='only_null').as_py():>10} "
f"{pc.count(value, mode='all').as_py():>6}"
)
```
#### Result
```
pyarrow: 24.0.0
case only_valid only_null all
plain 6 4 10
ree 10 0 10
slice plain 3 3 6
slice ree 6 0 6
```
--
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]