Repository navigation
Conversation
This branch has not been deployed
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.
Which issue does this PR close?
Rationale for this change
When zipping two scalar
StringVieworBinaryViewvalues (directly withzipor viaScalarZipper), each scalar represents a single value, so it can reference at most one buffer (zero buffers if inlined, or one buffer if out-of-line).Previously, zipping cloned and retained the entire
data_buffers()slice from each scalar array. When scalars were sliced from larger multi-buffer arrays, unreferenced buffers stayed alive in bothScalarZipperand every output array it produced.What changes are included in this PR?
In
arrow-select/src/zip.rs:ByteViewScalarImplto hold only the singleBufferit references (none for inline or null scalars; one buffer withbuffer_indexrewritten to0for out-of-line scalars).0buffers for empty (len == 0) or all-inline outputs,1buffer when both out-of-line scalars reference the same buffer (Buffer::ptr_eq), and2buffers when they reference distinct buffers.data_buffers()in existing sliced-inline tests and add unit tests covering multi-bufferStringViewArrayandBinaryViewArrayslices, shared buffers, single non-null scalars with null masks, empty masks, andScalarZipperreuse.Are these changes tested?
Yes. Existing and new unit tests are included in
arrow_select::zip::test:test_zip_kernel_scalar_strings_array_view_sliced_inline(now assertsdata_buffers().is_empty())test_zip_kernel_scalar_binary_array_view_sliced_inline_max_len(now assertsdata_buffers().is_empty())test_zip_scalar_byte_view_only_retains_referenced_bufferstest_zip_scalar_byte_view_single_non_null_buffer_retentiontest_scalar_zipper_byte_view_reuse_minimal_buffersAre there any significant user-facing changes?
No breaking API changes. Output arrays from
zipandScalarZipperonStringViewandBinaryViewscalars now retain only the buffers actually referenced by the output views (0,1, or2buffers).AI usage disclosure
AI coding assistance was used to draft the implementation, unit tests, and PR description; all code changes and test results were reviewed by the author.