You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
raulcd
changed the title
Creating a table from a sliced struct array drops the slice
[Python] Creating a table from a sliced struct array drops the slice
Nov 14, 2024
I understand the use case but I am unsure what should be the behavior in order to generate the RecordBatch if we have updated the offset with the slice as an example:
>>> pa.table(pa.array([{'a': 0}, {'a': 1}, {'a': 2}]).slice(1,2))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "pyarrow/table.pxi", line 6172, in pyarrow.lib.table
batch = record_batch(data, schema)
File "pyarrow/table.pxi", line 5991, in pyarrow.lib.record_batch
batch = RecordBatch._import_from_c_device_capsule(schema_capsule, array_capsule)
File "pyarrow/table.pxi", line 4002, in pyarrow.lib.RecordBatch._import_from_c_device_capsule
batch = GetResultValue(ImportDeviceRecordBatch(c_array, c_schema))
File "pyarrow/error.pxi", line 155, in pyarrow.lib.pyarrow_internal_check_status
return check_status(status)
File "pyarrow/error.pxi", line 92, in pyarrow.lib.check_status
raise convert_status(status)
pyarrow.lib.ArrowInvalid: ArrowArray struct has non-zero offset, cannot be imported as RecordBatch
>>> pa.array([{'a': 0}, {'a': 1}, {'a': 2}]).slice(1,2)
<pyarrow.lib.StructArray object at 0x764b3cf5d8a0>
-- is_valid: all not null
-- child 0 type: int64
[
1,
2
]
>>>
Describe the bug, including details regarding any error messages, version, and platform.
Currently on pyarrow 17.0.0 creating a table from a sliced struct array ignores slice bounds
I expect
Component(s)
Python
The text was updated successfully, but these errors were encountered: