Repository navigation
Move numeric and boolean cast helpers into a private submodule - #11076
Conversation
2efc07f to
08fd5b1
Compare
|
could we merge up to resolve the conflict |
|
Merged |
|
please doublecheck this PR, it seems to regress changes introduced by #11242 |
|
Good catch — you're right. When relocating the bool casts into the
Also double-checked the reverse direction and the other cast families in the module against |
…he#11077) # Which issue does this PR close? Part of apache#11032 — the **binary, fixed-size binary and byte-view helpers** group only, so it does not close the issue. Sibling PRs against the same issue: apache#11075 (temporal) and apache#11076 (numeric and boolean). All three are independent and move disjoint functions, but each adds a `mod` line and an import to `mod.rs`, so whichever lands later will want a trivial rebase. # Rationale for this change `arrow-cast/src/cast/mod.rs` is ~14k lines. apache#5125 moved list, decimal, dictionary, string, map, run-array and union support into private submodules, and apache#11032 lists the groups still inline. The byte-oriented conversions are one of them. # What changes are included in this PR? A new private `arrow-cast/src/cast/binary.rs` holding: - `cast_numeric_to_binary` - `cast_binary_to_fixed_size_binary` - `cast_fixed_size_binary_to_binary` - `cast_fixed_size_binary_to_binary_view` - `cast_byte_container` - `cast_view_to_byte` `cast_with_options` stays the top-level dispatcher in `mod.rs`. Worth flagging for review: - **No public API surface is involved here.** Unlike the numeric group in apache#11076, none of these six were `pub`, so `mod.rs` uses a plain `use crate::cast::binary::*` rather than a `pub use`. All six are called from the dispatcher, so all six became `pub(crate)` and nothing stayed private. - **`cast_numeric_to_binary` is not adjacent to the rest.** It sits up with the numeric helpers in `mod.rs` rather than with the other byte conversions, but it belongs to this group, so it is moved from there. - Three imports left orphaned in `mod.rs` by the move are dropped: `arrow_data::ByteView`, and `Buffer` from the `arrow_buffer` import list. # Are these changes tested? Covered by the existing `arrow-cast` tests — this is a code move, so no new tests are warranted and no existing 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 ``` As with the sibling PRs, the faithfulness of the move is checked mechanically rather than by eye: extracting the two original line ranges from `HEAD` and normalising away the added `pub(crate)` gives a **byte-identical** match against the new file. 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 and no behavioural change. # 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. The moved bodies are unedited, and the byte-identity check is the evidence for that rather than a reading. The judgement calls — pulling `cast_numeric_to_binary` out of the numeric neighbourhood, the uniform `pub(crate)`, and the three dropped imports — are listed above because they are the parts a "pure move" diff would not otherwise draw attention to.
| use crate::cast::dictionary::*; | ||
| use crate::cast::list::*; | ||
| use crate::cast::map::*; | ||
| pub use crate::cast::numeric::*; |
There was a problem hiding this comment.
id prefer not making it public by default, it makes it too easy to accidentally introduce a new public api
There was a problem hiding this comment.
Done in f93fa86: the glob pub use is gone. The numeric submodule is imported privately, and only the three helpers that were already public before the move (cast_num_to_bool, num_cast, single_bool_to_numeric) keep explicit pub use re-exports, so nothing new becomes public by default.
|
can i ask is there any human on the end of this? the comments seem extremely LLM, and it seems theres very little effort being put into this PR. for example, an update was made per comments, but the merge conflict was ignored and not also updated. |
f93fa86 to
605f7a0
Compare
|
Yes, there is a human here 🙋♂️ , sorry. I opened four PRs on 13 September for issue #11032. All four move code out of I handed that merge work, and some of these replies, to an AI tool. I did not
You spent your time on slop that i should have reviewed before pushing. Now coming to the state of the PRs - I did not resolve the conflicts by hand. Upstream had changed several of the Both branches now only move the existing code into the new module, without changing its logic or behavior.
Going forward, i will -
Hope this clarifies. Thanks for your patience, and sorry once again for the |
This will be most appreciated 🙏
I think the point here is that the most value you can add, as an author, is to make it easy to understand your propsoed changes to others (aka us as reviewers) so we can get the changes in efficiently The more concise / easier to understand what you are doing here the better. For example, the details of what you had to do to resolve the merge conflict in English prose is not very helpful (how does it help us determine if we should merge this PR?)
|
|
CI appears to be failing due to a clippy problem |
|
Fixed the clippy failure. Two imports were only used by tests, so I moved them into the test module. |
|
Sorry the last merge went wrong 😟 I've reset the branch onto current main and redone the move as a single commit. It's now +206/−180 |
e79270b to
b96bb58
Compare

Which issue does this PR close?
Rationale for this change
Continues splitting up
cast/mod.rs.What changes are included in this PR?
Moves the numeric and boolean cast helpers into a new
cast/numeric.rs. Code is unchanged apart frompub(crate)visibility.Are these changes tested?
Covered by existing tests.
Are there any significant user-facing changes?
No. The public helpers are re-exported, so their paths are unchanged.