Move temporal cast helpers into a private submodule - #11075
Open
anandghegde wants to merge 1 commit into
Open
anandghegde wants to merge 1 commit into
anandghegde wants to merge 1 commit into
Conversation
Follow-up to apache#5125, continuing the extractions in apache#5537 and friends. `arrow-cast/src/cast/mod.rs` still holds the timestamp, date, duration, interval and timezone helpers. Move them into a private `temporal` submodule, leaving `cast_with_options` as the top-level dispatcher. The function bodies are moved verbatim; the only edit is the `pub(crate)` visibility they need to stay reachable from `mod.rs`, matching the convention in `string.rs` and `list.rs`. `cast_reinterpret_arrays` stays in `mod.rs`: it sat inside this block but is a generic primitive helper used across the numeric, temporal and dictionary paths. No behavioural change and no public API change.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.rsis ~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.rsholding:cast_interval_year_month_to_interval_month_day_nanocast_interval_day_time_to_interval_month_day_nanocast_month_day_nano_to_durationcast_duration_to_intervalmake_timestamp_array,make_duration_arrayas_time_res_with_timezonetimestamp_to_date32adjust_timestamp_to_timezonecast_with_optionsstays the top-level dispatcher inmod.rs.Two things worth flagging for review:
cast_reinterpret_arraysdeliberately stays inmod.rs. It sits in themiddle of this block, so it looks like part of the group, but it is a generic
PrimitiveArray::reinterpret_castwrapper with 23 call sites across thenumeric, temporal and dictionary paths — not temporal-specific.
pub(crate), which is what they need to stay reachablefrom
mod.rsthrough the glob import, matchingstring.rsandlist.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
HEADand normalising away thepub(crate)prefix gives a byte-identical match against the new file.Are these changes tested?
Covered by the existing
arrow-casttests — this is a code move, so no newtests are warranted and no test was modified.
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.rsimports dropped (IntervalMonthDayNano, andNaiveTime/Offsetfromchrono) 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_arraysbehind, andthe
pub(crate)visibility — are called out above precisely because they are theparts a diff of a "pure move" would not otherwise draw attention to.