Aurantium-47 opened a new pull request, #55719:
URL: https://github.com/apache/arrow/pull/55719

   ### Rationale for this change
   
   Addresses #35126. Repeatedly slicing a table with many chunks recreates 
Array and ArrayData wrappers for chunks that are included in full. Reusing 
those wrappers reduces this overhead for full aligned plain chunks; their 
payload buffers were already zero-copy.
   
   ### What changes are included in this PR?
   
   In `ChunkedArray::Slice`, reuse the existing Array wrapper when a chunk is 
included in full at an aligned boundary, has no statistics, child data or 
dictionary, and is not an extension array. Boundary chunks, statistics-bearing 
chunks, nested arrays, dictionary arrays and extension arrays retain the 
previous slicing path.
   
   Add regression tests for wrapper reuse across aligned plain chunks 
(including an empty chunk and a chunk with a nonzero logical offset), partial 
boundary values, and dropping statistics through the existing path.
   
   ### Are these changes tested?
   
   Prior local validation used this exact patch at upstream main 
`cba325ed67235fe16c307b9cf974a54433d9f9c7`:
   
   - Native `arrow-table-test` linked to the locally built `libarrow.so.2700`: 
**213/213 passed**, including **16/16 TestChunkedArray**.
   - An exact-method native benchmark using a common Arrow `27.0.0-SNAPSHOT` 
library measured median time from **0.869 s to 0.114 s** for a synthetic 
repeated shrinking-tail workload with **1,000 chunks × 1,024 rows × 10 
columns**. **692 slice comparisons** and additional guard/lifetime checks 
passed. These timings describe that synthetic workload only.
   
   Submission checks also passed: `git apply --check`, `git diff --check`, 
exact changed-file scope, and byte-for-byte agreement between the applied diff 
and the verified patch (SHA-256 
`f22fe8d566c73b9c587587c145629b85a38c39ad9e9ef1033ba8cf34bf5c1151`). Current 
upstream main still matches the tested commit. The native tests and benchmark 
were completed before this submission; they were not rerun during submission.
   
   ### Are there any user-facing changes?
   
   Full aligned plain chunks now preserve **Array and ArrayData pointer 
identity** with the input instead of creating new wrappers. Keeping the slice 
alive can therefore extend the lifetime of the original Array and ArrayData 
wrappers, and their metadata objects are shared. Payload buffers were already 
shared by the previous zero-copy path. The guarded cases listed above retain 
their previous behavior.
   
   ### Was AI used for this PR?
   
   ChatGPT assisted the implementation and local testing. Codex prepared this 
PR description and submitted this draft.
   


-- 
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]

Reply via email to