Split arrow_cast::cast struct helpers into their own submodule - #11074
Open
amitvijapur wants to merge 1 commit into
Open
Split arrow_cast::cast struct helpers into their own submodule#11074amitvijapur wants to merge 1 commit into
amitvijapur wants to merge 1 commit into
Conversation
Moves cast_struct_to_struct, cast_struct_fields_by_name and cast_struct_fields_in_order out of cast/mod.rs into a private structs submodule, following the shape of apache#5537. No behaviour change; cast_with_options remains the dispatcher. Part of apache#11032.
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. Takes the struct conversion helpers group; the other four groups are left for separate PRs as the issue asks.
Rationale for this change
arrow-cast/src/cast/mod.rsis 14,312 lines. #5125 and its follow-ups (#5537, #5552, #5555, #5563) moved list, decimal, dictionary, string, map, run-array and union casting into private submodules. The struct helpers are a small cohesive group still sitting inmod.rs, so this continues that series in the same shape.What changes are included in this PR?
arrow-cast/src/cast/structs.rscontainingcast_struct_to_struct,cast_struct_fields_by_nameandcast_struct_fields_in_order, moved frommod.rs.mod structs;anduse crate::cast::structs::*;added tomod.rsin alphabetical position, matching how the existing submodules are wired.cast_struct_to_structbecomespub(crate)becausecast_with_optionscalls it frommod.rs. The other two are only called from within the new file and stay plainfn, followinglist.rs, which keeps its inner helper private.cast_with_optionsis untouched and remains the dispatcher; the call site atmod.rs:1233is byte-identical tomain.The module is named
structsbecausestructis a keyword. Happy to rename tostruct_arrayor anything else if preferred.No behaviour change. To verify that mechanically rather than by inspection: taking the lines removed from
mod.rsand diffing them against the body ofstructs.rswith the onepub(crate)prefix stripped, the only difference is the blank line that separated the last helper fromcast_from_decimal, which correctly stays inmod.rs. The 67 lines of code, including comments and wrapping, are identical.Are these changes tested?
By the existing tests.
test_cast_struct_to_struct,test_cast_struct_to_struct_nullabilityand the othercast_struct_*tests exercise these helpers through the publiccastAPI and are unchanged.cargo test -p arrow-cast --lib: 379 passed, 0 failedcargo clippy -p arrow-cast --all-targets --all-features -- -D warnings: cleancargo fmt --all -- --check: cleancargo doc -p arrow-cast --no-deps: none of the three helper names appear in the generated docs, confirming nothing new is exportedAre there any user-facing changes?
No. The three functions were private before and remain crate-private;
structsis a private module and the glob import is notpub use.AI usage disclosure
Per CONTRIBUTING.md: the extraction was performed with Claude Code assistance. The moved code is the existing upstream code, not generated. AI was used to locate the helper group, perform the mechanical move, and run the verification above. I reviewed the full diff and the verification output before opening this.