reproducer below
importnumpyasnpimportpyarrowaspaarr=pa.array([np.arange(x).astype(np.int8) forxinrange(6)])
nb_repeat=2**32//arr.offsets.to_numpy()[-1]
indices=pa.array(np.repeat(np.arange(len(arr)), nb_repeat))
big_arr=arr.take(indices)
print(big_arr.offsets[-5:])
big_arr.validate() # hopefully this can catch it
[
-21,
-16,
-11,
-6,
-1
]
---------------------------------------------------------------------------ArrowInvalidTraceback (mostrecentcalllast)
<ipython-input-1-09503f9cbb04>in<module>6big_arr=arr.take(indices)
7print(big_arr.offsets[-5:])
---->8big_arr.validate()
/opt/conda/envs/model/lib/python3.7/site-packages/pyarrow/array.pxiinpyarrow.lib.Array.validate()
/opt/conda/envs/model/lib/python3.7/site-packages/pyarrow/error.pxiinpyarrow.lib.check_status()
ArrowInvalid: Negativeoffsetsinlistarray
and it works fine with large_array (as expected) :
importnumpyasnpimportpyarrowaspaarr=pa.array([np.arange(x).astype(np.int8) forxinrange(6)], type=pa.large_list(pa.int8()))
nb_repeat=2**32//arr.offsets.to_numpy()[-1]
indices=pa.array(np.repeat(np.arange(len(arr)), nb_repeat))
big_arr=arr.take(indices)
print(big_arr.offsets[-5:])
big_arr.validate()
[
4294967275,
4294967280,
4294967285,
4294967290,
4294967295
]
Reporter: Artem KOZHEVNIKOV / @artemru
Related issues:
Note: This issue was originally created as ARROW-10494. Please see the migration documentation for further details.
reproducer below
and it works fine with large_array (as expected) :
Reporter: Artem KOZHEVNIKOV / @artemru
Related issues:
Note: This issue was originally created as ARROW-10494. Please see the migration documentation for further details.