amitvijapur opened a new pull request, #11074: URL: https://github.com/apache/arrow-rs/pull/11074
# 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.rs` is 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 in `mod.rs`, so this continues that series in the same shape. # What changes are included in this PR? - New private module `arrow-cast/src/cast/structs.rs` containing `cast_struct_to_struct`, `cast_struct_fields_by_name` and `cast_struct_fields_in_order`, moved from `mod.rs`. - `mod structs;` and `use crate::cast::structs::*;` added to `mod.rs` in alphabetical position, matching how the existing submodules are wired. - `cast_struct_to_struct` becomes `pub(crate)` because `cast_with_options` calls it from `mod.rs`. The other two are only called from within the new file and stay plain `fn`, following `list.rs`, which keeps its inner helper private. - `cast_with_options` is untouched and remains the dispatcher; the call site at `mod.rs:1233` is byte-identical to `main`. The module is named `structs` because `struct` is a keyword. Happy to rename to `struct_array` or anything else if preferred. No behaviour change. To verify that mechanically rather than by inspection: taking the lines removed from `mod.rs` and diffing them against the body of `structs.rs` with the one `pub(crate)` prefix stripped, the only difference is the blank line that separated the last helper from `cast_from_decimal`, which correctly stays in `mod.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_nullability` and the other `cast_struct_*` tests exercise these helpers through the public `cast` API and are unchanged. - `cargo test -p arrow-cast --lib`: 379 passed, 0 failed - `cargo clippy -p arrow-cast --all-targets --all-features -- -D warnings`: clean - `cargo fmt --all -- --check`: clean - `cargo doc -p arrow-cast --no-deps`: none of the three helper names appear in the generated docs, confirming nothing new is exported # Are there any user-facing changes? No. The three functions were private before and remain crate-private; `structs` is a private module and the glob import is not `pub 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. -- 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]
