GH-50994: [C++][Compute] Implement casting from ListView to List with zero-copy fast-path - #50976
GH-50994: [C++][Compute] Implement casting from ListView to List with zero-copy fast-path#50976Jay846 wants to merge 2 commits into
Conversation
|
Thanks for opening a pull request! This pull request has been automatically converted to a draft because its title doesn't match Arrow's required format. If this is not a minor PR. Could you open an issue for this pull request on GitHub? https://github.com/apache/arrow/issues/new/choose Opening GitHub issues ahead of time contributes to the Openness of the Apache Arrow project. Then could you also rename the pull request title in the following format? or After updating the title, you can mark the pull request as ready for review. See also: |
Reranko05
left a comment
There was a problem hiding this comment.
Could you use the Arrow PR title template:-
GH-<Issue Number>: [<Component>] <Title>
|
|
|
You should use issue id but not the PR's id. If there isn't an existed issue, you can create a new one. |
|
|
Rationale for this change
This PR implements missing type-casting compute kernels to convert
ListViewTypeandLargeListViewTypearrays to standardListTypeandLargeListTypearrays. This directly addresses legacy cast removal requirements under Arrow's compute framework.What changes are included in this PR?
To maximize performance and optimize memory layouts, a dual-execution path was implemented in the
CastListViewexecution functor insidescalar_cast_nested.cc:offsets[i] + sizes[i] == offsets[i+1]). It avoids copying the child values array entirely, allocating the new output offset buffer, shifting offsets relative to the start, and slicing the child array directly to preserve zero-copy pointer semantics.Int64Builder, and invokes Arrow's internaltakecompute kernel to reconstruct a new contiguous child values array.Are these changes tested?
Yes, added comprehensive unit test suites in
scalar_cast_test.ccpassing 109 out of 109 cases in the scalar cast suite. Tests explicitly cover:utf8strings) and recursive child type promotions (e.g.,ListView<int16>toList<int32>).Are there any user-facing changes?
No public API contracts were broken. This adds declarative casting support natively to the existing internal compute framework.