hombit opened a new issue, #39129:
URL: https://github.com/apache/arrow/issues/39129

   ### Describe the bug, including details regarding any error messages, 
version, and platform.
   
   `pyarrow` doesn't support byte-swapped arrays, but it doesn't check it for 
list-arrays. So this code would fail with an assertion error, because the 
scalar equals 256 instead of 1:
   
   ```python
   import numpy as np
   import pyarrow as pa
   
   # Big-endian byte order
   np_a = np.array([1], dtype='>u2')
   # Build a list array, supposed to be [[1]]
   pa_a = pa.array([np_a])
   scalar = pa_a[0][0]
   # The scalar is 256 here, not 1
   assert scalar.as_py() == 1, f'{scalar} != 1'
   ```
   
   I believe that an expected behavior  is to fail with 
`ArrowNotImplementedError: Byte-swapped arrays not supported`, just like this 
code would do:
   
   ```python
   import numpy as np
   import pyarrow as pa
   
   # Big-endian byte order
   np_a = np.array([1], dtype='>u2')
   pa_a = pa.array(np_a)
   ```
   
   ### Environment
   - Linux 4.18.0 x86_64
   - Python 3.9.13
   - Pyarrow 14.0.1
   
   ### Component(s)
   
   Python


-- 
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]

Reply via email to