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

   # Which issue does this PR close?
   
   - Closes #11862.
   
   # Rationale for this change
   
   `ArrayData::build` only requires an `Interval(DayTime)` values buffer to be 
aligned to `align_of::<IntervalDayTime>()` (4 bytes, since it is a `#[repr(C)]` 
struct of two `i32`s). `MutableArrayData` extended it as `i64`, so 
`Buffer::typed_data::<i64>` asserted 8-byte alignment and panicked on a valid, 
4-byte aligned buffer. Every kernel built on `MutableArrayData` (`zip`, 
`merge`, `concat` of some layouts, ...) hit this. This is the `DayTime` 
counterpart of #5917, which #10171 fixed for `MonthDayNano`.
   
   # What changes are included in this PR?
   
   `build_extend` and `build_extend_nulls` now use `IntervalDayTime` for 
`Interval(DayTime)`, the same way `MonthDayNano` uses `IntervalMonthDayNano`. 
The element size is unchanged (8 bytes), so the produced buffers are identical; 
only the alignment requirement drops to the one `ArrayData` already validates.
   
   # Are these changes tested?
   
   Yes. Added `test_interval_day_time_aligned_to_4` in 
`arrow/tests/array_transform.rs`, which builds an `Interval(DayTime)` array on 
a buffer starting at 4 mod 8, extends it and a null through `MutableArrayData`, 
and checks the result. It panics at `arrow-buffer/src/buffer/immutable.rs:334` 
without the change and passes with it. `cargo test -p arrow --test 
array_transform`, `cargo test -p arrow-data -p arrow-select` and `cargo clippy 
-p arrow-data --all-targets -- -D warnings` pass.
   
   # Are there any user-facing changes?
   
   No API changes; kernels no longer panic on 4-byte aligned 
`Interval(DayTime)` arrays.
   
   This PR was prepared with AI assistance and reviewed/tested by the author.
   


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