memosmorgan opened a new pull request, #11432: URL: https://github.com/apache/arrow-rs/pull/11432
# Which issue does this PR close? - Closes #9140 # Rationale for this change Owned `ArrayData` can be sliced without allocating new buffer or child vectors. AI assistance: OpenAI Codex generated the implementation and tests, ran the local checks, and reviewed the diff. # What changes are included in this PR? Add `ArrayData::sliced`, which consumes the array and reuses its allocations, including nested struct children. Use it when converting owned data to `StructArray`. # Are these changes tested? Regression tests cover equivalence with borrowed slicing, offsets, nested structs, lists, nulls, empty/end slices, and bounds. They also check that vector allocations are retained. A local release-mode allocation counter measured the following for 1,024-element inputs sliced at offset 1 for 512 elements, excluding input construction: | Data | `slice` allocations | `sliced` allocations | | --- | ---: | ---: | | Int32 | 1 | 0 | | Nested Struct | 3 | 0 | | List<Int32> | 3 | 0 | # Are there any significant user-facing changes? No breaking changes. Borrowed `slice` retains its existing behavior. -- 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]
