Skip to content

fix: Only validate relevant type_ids for array view slice#627

Merged
paleolimbot merged 3 commits intoapache:mainfrom
paleolimbot:union-buffer-validation
Sep 20, 2024
Merged

fix: Only validate relevant type_ids for array view slice#627
paleolimbot merged 3 commits intoapache:mainfrom
paleolimbot:union-buffer-validation

Conversation

@paleolimbot
Copy link
Member

@paleolimbot paleolimbot commented Sep 20, 2024

Similar to #626 but for union type_id arrays. This should fix the two remaining failures in the integration tests between the IPC implementations in the Arrow repository and the nanoarrow IPC implementation apache/arrow#43715.

@paleolimbot paleolimbot marked this pull request as ready for review September 20, 2024 15:55
if (array_view->storage_type == NANOARROW_TYPE_DENSE_UNION ||
array_view->storage_type == NANOARROW_TYPE_SPARSE_UNION) {
struct ArrowBufferView type_ids;
type_ids.size_bytes = array_view->length * sizeof(int8_t);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😄


if (array_view->storage_type == NANOARROW_TYPE_DENSE_UNION ||
array_view->storage_type == NANOARROW_TYPE_SPARSE_UNION) {
struct ArrowBufferView type_ids;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To make things clearer/consistenter, should we name this sliced_type_ids or so? (and rename minimal_offsets -> sliced_offsets)?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe later it'd be helpful to extract ArrowArrayViewSlice which produces an equivalent array view but with offset 0

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The ArrowArrayViewSlice will be useful for a bunch of things...to get consumer functions to work recursively with list types, many of them already accept ArrowArrayView*, offset, length.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, you meant as a function (will also be helpful!)

@paleolimbot paleolimbot merged commit 120a8e1 into apache:main Sep 20, 2024
@paleolimbot paleolimbot added this to the nanoarrow 0.6.0 milestone Sep 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants