[ 
https://issues.apache.org/jira/browse/ARROW-16081?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17515312#comment-17515312
 ] 

Jonathan Kenyon commented on ARROW-16081:
-----------------------------------------

That is fair - I am maintaining some code I didn't write so I don't necessarily 
understand the motivation behind using the buffers directly. I have managed to 
solve my issue (and now understand why zero copy isn't an option for bool 
values). I actually think using the buffers may be overkill in this case and 
will look at instead using flattened arrays which I can reshape/establish views 
over.

> Incorrect results when reading a buffer of boolean values
> ---------------------------------------------------------
>
>                 Key: ARROW-16081
>                 URL: https://issues.apache.org/jira/browse/ARROW-16081
>             Project: Apache Arrow
>          Issue Type: Bug
>          Components: Python
>    Affects Versions: 7.0.0
>         Environment: Ubuntu 20.04, Python 3.8.10, pyarrow==7.0.0
>            Reporter: Jonathan Kenyon
>            Priority: Major
>
> The following reproducer demonstrates that a buffer of boolean values is not 
> correctly recovered when using pyarrow.
> {code:python}
> import pyarrow.parquet as pq
> import pyarrow as pa
> import numpy as np
> if __name__ == "__main__":
>     data = np.array([True, False, True, False], dtype=bool)
>     length = len(data)
>     buf = pa.py_buffer(data)
>     array = pa.Array.from_buffers(pa.bool_(), length, [None, buf])
>     np.testing.assert_array_equal(data, array.to_numpy(zero_copy_only=False))
> {code}



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to