jaideeppyne opened a new pull request, #10835:
URL: https://github.com/apache/arrow-rs/pull/10835

   # Which issue does this PR close?
   
   - Closes #7750.
   - Closes #7595.
   
   # Rationale for this change
   
   Slicing a `Struct` `ArrayData` pushed the new offset into the child data 
*and* also added it to the parent's own `offset`. Rebuilding an array from the 
sliced data (`make_array` / `From<ArrayData> for StructArray`) then windowed 
the already-windowed children a second time and panicked with `(offset + 
length) <= self.len()`. This is a regression from 54.3.0 (it panics on 55.0.0 
through current main).
   
   This finishes the approach from #7596, which @alamb approved pending 
additional testing before it went stale.
   
   # What changes are included in this PR?
   
   In the `Struct` arm of `ArrayData::slice`, keep `self.offset` unchanged and 
let the cumulative child offsets carry the slice (a struct's `ArrayData` has no 
buffers of its own, now guarded by an assert).
   
   # Are these changes tested?
   
   Yes. Added `test_struct_array_data_slice` (the C data interface offset 
representation) and `test_make_array_sliced_struct_data` (the exact #7750 
reproducer), both failing before the change and passing after. Verified no 
regressions across arrow-data, arrow-array, arrow-select, arrow-ord, 
arrow-cast, and arrow-ipc.
   
   # Are there any user-facing changes?
   
   Slicing a struct `ArrayData` no longer panics on rebuild. The sliced 
`ArrayData` now represents the offset on its children with the parent offset 
unchanged — consistent with how `From<ArrayData> for StructArray` already 
interprets it.
   


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