anandghegde opened a new pull request, #11075:
URL: https://github.com/apache/arrow-rs/pull/11075
# Which issue does this PR close?
Part of #11032 — this is the **temporal helpers** group only, so it does not
close the issue. The remaining groups (numeric/boolean, binary/byte-view,
struct, decimal adapters) are untouched here. @amitvijapur mentioned taking
the
struct group; this branch does not touch it.
# Rationale for this change
`arrow-cast/src/cast/mod.rs` is ~14k lines. #5125 moved list, decimal,
dictionary, string, map, run-array and union support into private submodules,
and #11032 captures the groups still left inline. The timestamp, date,
duration, interval and timezone helpers are one such cohesive group.
# What changes are included in this PR?
A new private `arrow-cast/src/cast/temporal.rs` holding:
- `cast_interval_year_month_to_interval_month_day_nano`
- `cast_interval_day_time_to_interval_month_day_nano`
- `cast_month_day_nano_to_duration`
- `cast_duration_to_interval`
- `make_timestamp_array`, `make_duration_array`
- `as_time_res_with_timezone`
- `timestamp_to_date32`
- `adjust_timestamp_to_timezone`
`cast_with_options` stays the top-level dispatcher in `mod.rs`.
Two things worth flagging for review:
- **`cast_reinterpret_arrays` deliberately stays in `mod.rs`.** It sits in
the
middle of this block, so it looks like part of the group, but it is a
generic
`PrimitiveArray::reinterpret_cast` wrapper with 23 call sites across the
numeric, temporal and dictionary paths — not temporal-specific.
- **The helpers became `pub(crate)`**, which is what they need to stay
reachable
from `mod.rs` through the glob import, matching `string.rs` and `list.rs`.
Nothing new is exposed outside the crate.
The bodies are moved verbatim. I checked this mechanically rather than by
eye:
extracting the three original line ranges from `HEAD` and normalising away
the
`pub(crate)` prefix gives a byte-identical match against the new file.
# Are these changes tested?
Covered by the existing `arrow-cast` tests — this is a code move, so no new
tests are warranted and no test was modified.
```
cargo test -p arrow-cast 379 passed + 12 passed, 0 failed (same as base)
cargo clippy -p arrow-cast --all-targets -- -D warnings clean
cargo fmt -p arrow-cast -- --check clean
cargo build -p arrow builds
```
Run on macOS 26.6.2, aarch64-apple-darwin, toolchain 1.98.1 from
`rust-toolchain.toml`.
# Are there any user-facing changes?
No. No public API change, no behavioural change. Everything moved is private
to
the crate, and the two `mod.rs` imports dropped (`IntervalMonthDayNano`, and
`NaiveTime`/`Offset` from `chrono`) were orphaned by the move.
# AI usage disclosure
Written with AI assistance (Claude). The AI performed the mechanical
extraction
and ran the verification above; I reviewed the result and own the change.
To be concrete about what that means here, since the value of a code move is
entirely in it being faithful: the moved bodies are unedited, and the
byte-identity check described above is the evidence for that rather than a
reading. The two judgement calls — leaving `cast_reinterpret_arrays` behind,
and
the `pub(crate)` visibility — are called out above precisely because they
are the
parts a diff of a "pure move" would not otherwise draw attention to.
--
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]