ump45nose opened a new pull request, #11676: URL: https://github.com/apache/arrow-rs/pull/11676
# Which issue does this PR close? - Closes #11669. # Rationale for this change When `zip` takes byte view scalars (`Utf8View` / `BinaryView`), the output kept every data buffer of the arrays the scalars were sliced from. A scalar holds one value, so it references at most one buffer, and the output never needs more than two. The extra buffers kept unrelated memory alive and made the output look larger than it is. # What changes are included in this PR? `ByteViewScalarImpl::get_value_from_scalar` now keeps only the buffer the scalar's view points to, and rewrites the view's buffer index to 0. An inline value keeps no buffer, and a null keeps none, as before. The rest of `ByteViewScalarImpl` is unchanged, so the mixed-mask path still appends the falsy buffer after the truthy one. # Are these changes tested? Yes. `test_zip_kernel_scalar_strings_array_view_keeps_only_referenced_buffers` slices each scalar from a `StringViewArray` with three buffers, then checks the values and the number of output buffers for a mixed mask (2), an all-true mask (1), and a null truthy scalar (1). Without the fix the mixed case returns 6 buffers. # Are there any significant user-facing changes? No. AI disclosure: I used an AI coding assistant to write the fix, the test and this description, and I reviewed all of it. The part worth a reviewer's look is the buffer index rewrite in `get_value_from_scalar`. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
