jorisvandenbossche opened a new issue, #51:
URL: https://github.com/apache/arrow-nanoarrow/issues/51
I don't have an easy reproducer since the python bindings are not yet there,
but with this cython function to isolate `ArrowBitCountSet`:
```
def count_valid(arr):
cdef ArrowSchema schema
cdef ArrowArray array
cdef ArrowArrayView array_view
cdef ArrowError error
arr._export_to_c(<uintptr_t> &array, <uintptr_t> &schema)
ArrowArrayViewInitFromSchema(&array_view, &schema, &error)
valid_count = -1
if array_view.layout.buffer_type[0] == NANOARROW_BUFFER_TYPE_VALIDITY:
if array.buffers[0] != NULL:
valid_count = ArrowBitCountSet(<const uint8_t
*>array.buffers[0], 0, array.length)
return valid_count
```
I get:
```
import pyarrow as pa
import nanoarrow
>>> arr = pa.array([1, 2, None, 4, 5, 6, 7])
>>> nanoarrow.count_valid(arr)
0
>>> arr = pa.array([1, 2, None, 4, 5, 6, 7, 8])
>>> nanoarrow.count_valid(arr)
7
```
So it seems that as long the bitmap is max a single byte, it always returns
0 (unless there is something wrong in the way I am calling it?)
--
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]