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
Describe the bug, including details regarding any error messages, version, and platform.
list_element on list_view / large_list_view arrays computes each list's length from offsets[i + 1] - offsets[i] instead of the sizes buffer, so it fails (or silently returns the wrong
element) whenever the views aren't laid out like list offsets:
importpyarrowaspa, pyarrow.computeaspclv=pa.ListViewArray.from_arrays(pa.array([2, 0, 1], pa.int32()),
pa.array([2, 2, 1], pa.int32()),
pa.array([1, 2, 3, 4]))
print(lv.to_pylist()) # [[3, 4], [1, 2], [2]]pc.list_element(lv, 0)
# ArrowInvalid: Index 0 is out of bounds: should be in [0, -2) expected [3, 1, 2]lv2=pa.ListViewArray.from_arrays(pa.array([0, 3], pa.int32()), pa.array([1, 2], pa.int32()),
pa.array([10, 20, 30, 40, 50])).slice(0, 1)
print(lv2.to_pylist()) # [[10]]pc.list_element(lv2, 2) # [30] expected an out-of-bounds error
ListElement::Exec in cpp/src/arrow/compute/kernels/scalar_nested.cc is registered for the list-view
types but never reads buffer 2. For the last element it also reads offsets[length], one past the end
of a list-view offsets buffer. Other list kernels (list_value_length, list_slice, list_flatten, list_contains) handle the same arrays correctly. Similar to GH-51612, which is the same problem in the
list_view -> list cast.
I hit this while checking list kernels against list-view arrays; the silent wrong value on the sliced array worried me more than the error, since it gives no sign anything went wrong.
Reproduced on main (52d252f) and pyarrow 27.0.0.dev204 nightly, Linux x86_64. I have a small fix with a
test (use sizes[i] for list-view inputs, as list_slice already does) and can open a PR.
This issue was drafted with help from an AI assistant and checked by me.
changed the title [-][C++][Compute] list_element ignores list-view sizes[/-][+][Python][C++][Compute] list_element ignores list-view sizes[/+]on Dec 2, 2026
Activity
[-][C++][Compute] list_element ignores list-view sizes[/-][+][Python][C++][Compute] list_element ignores list-view sizes[/+]