Repository navigation
fix(arrow-select): compact nested view buffers in BatchCoalescer (#12530) - #12531
Mola-maker wants to merge 2 commits into
Conversation
Ap-95671
left a comment
There was a problem hiding this comment.
I verified the inline-only sparse selection on this revision. The targeted test reproduced 90,000 bytes retained. After a local adjustment to the zero-usage guard, all 75 coalescing tests passed, including the added case.
AI-assisted review with OpenAI Codex, submitted on behalf of Ap-95671.
| ) -> Option<GenericByteViewArray<T>> { | ||
| let used = array.total_buffer_bytes_used(); | ||
| if used == 0 { | ||
| return None; |
There was a problem hiding this comment.
One edge case to consider: a sparse take can retain only inline values, so used is zero while the nested child still owns its original backing buffers. Reusing the sparse-take test setup with 100 selected inline rows and 900 unselected 100-byte values, List<Utf8View> kept 90,000 backing bytes while top-level Utf8View kept zero. Letting zero reach the existing capacity check dropped the buffers in the reproduction. gc() has a fast path that reuses the inline views, so it does not copy the string payload. An early data_buffers().is_empty() check would keep buffer-free arrays cheap. Could the sparse-take test cover this case too?
There was a problem hiding this comment.
Fixed in 41e7180. The zero-usage guard is gone. An inline-only selection now reaches the capacity check and drops its backing buffers. Buffer-free arrays still skip the check through data_buffers().is_empty(). The sparse-take test now covers the inline-only case.
Which issue does this PR close?
BatchCoalescerretains oversized data buffers for nested view arrays #12530Rationale for this change
BatchCoalescer compacted top-level view columns after a sparse take. Nested views in List, Struct, Map, and FixedSizeList kept the whole source buffers.
What changes are included in this PR?
BatchCoalescer::finish_buffered_batchnow walks finished columns and compacts nested view arrays whose buffers hold more than twice the bytes their values use.Are these changes tested?
Yes. Two new tests cover the sparse take from the issue for Utf8View and BinaryView in List, Struct, FixedSizeList, Map, and a List of Struct.

Are there any significant user-facing changes?
No.
AI usage disclosure
Harness: Muse
Model: Muse Spark
Effort: default
Role: Muse drafted the investigation, fix, and tests under my direction; I reviewed the diff and ran the tests.