Repository navigation
fix(row): apply array offsets in ArrowArray wrappers - #1039
Merged
wgtmac merged 1 commit intoOct 21, 2026
Merged
Conversation
ArrowArrayStructLike, ArrowArrayArrayLike and ArrowArrayMapLike ignored the offset of the wrapped ArrowArray, so sliced inputs returned wrong rows: - Struct children are not shifted by the parent's offset in the Arrow C data interface, so GetField must add the struct's own offset. - ArrowArrayViewListChildOffset and the raw map offsets buffer are indexed without the array's offset, so list/map rows must add it before lookup. - Map key/value children are not shifted by the entries struct's offset. Add tests for sliced struct, list and map arrays.
YinZheng-Sun
force-pushed
the
fix/arrow-array-wrapper-sliced-offset
branch
from
October 19, 2026 03:58
4a9aab8 to
7c30438
Compare
shangxinli
reviewed
Oct 20, 2026
| offset_ = offsets_buffer[row_index_]; | ||
| length_ = offsets_buffer[row_index_ + 1] - offset_; | ||
| const int64_t row = array_view_.offset + row_index_; | ||
| offset_ = offsets_buffer[row]; |
Contributor
There was a problem hiding this comment.
The XXX note above is stale - ArrowArrayViewListChildOffset does handle NANOARROW_TYPE_MAP, see inline_array.h 1114-1120. The helper would drop exactly the arithmetic this PR is fixing.
shangxinli
reviewed
Oct 20, 2026
| internal::ArrowArrayGuard array_guard(&c_array); | ||
| ASSERT_TRUE(::arrow::ExportType(*root_type, &c_schema).ok()); | ||
| ASSERT_TRUE(::arrow::ExportArray(*sliced, &c_array).ok()); | ||
| ASSERT_EQ(c_array.offset, 1); |
Contributor
There was a problem hiding this comment.
This slices only the parent, so no child ever carries its own offset. The map test asserts children[0]->offset is 1 - worth the same here.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ArrowArrayStructLike, ArrowArrayArrayLike and ArrowArrayMapLike ignored the offset of the wrapped ArrowArray, so sliced inputs returned wrong rows:
Add tests for sliced struct, list and map arrays.