Describe the enhancement requested
Currently, Apache Arrow C++ does not support casting from ListView or LargeListView arrays to standard List or LargeList arrays correctly.
Although the casting kernels are registered, they incorrectly route to the standard List-to-List casting kernel (CastList). Because CastList ignores the sizes buffer of ListView (assuming contiguous elements where size is offset[i+1] - offset[i]) and attempts to read length + 1 offsets from a buffer that may only contain length elements, casting a ListView to List silently produces a corrupted ListArray with invalid/negative offsets and triggers out-of-bounds reads.
This enhancement introduces a dedicated casting path for ListView/LargeListView:
- A fast-path for contiguous ListView inputs, performing zero-copy casting by slicing the child values array and adjusting offsets.
- A fallback path for non-contiguous, gapped, or overlapping ListView inputs, using indices generation and the
take kernel to reconstruct contiguous child values arrays before casting.
Component(s)
C++
Describe the enhancement requested
Currently, Apache Arrow C++ does not support casting from ListView or LargeListView arrays to standard List or LargeList arrays correctly.
Although the casting kernels are registered, they incorrectly route to the standard List-to-List casting kernel (
CastList). BecauseCastListignores the sizes buffer ofListView(assuming contiguous elements where size isoffset[i+1] - offset[i]) and attempts to readlength + 1offsets from a buffer that may only containlengthelements, casting aListViewtoListsilently produces a corruptedListArraywith invalid/negative offsets and triggers out-of-bounds reads.This enhancement introduces a dedicated casting path for ListView/LargeListView:
takekernel to reconstruct contiguous child values arrays before casting.Component(s)
C++