Skip to content

Move remaining decimal adapters into the decimal submodule - #11078

Merged
Jefffrey merged 1 commit into
apache:mainfrom
anandghegde:extract-decimal-cast-adapters
Oct 27, 2026
Merged

Jefffrey merged 1 commit into
apache:mainfrom
anandghegde:extract-decimal-cast-adapters

Conversation

@anandghegde

@anandghegde anandghegde commented Sep 13, 2026 •

Copy link
Copy Markdown
Contributor

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 remaining decimal adapters (integer_to_decimal_native, integers_fit_digits, cast_integer_to_decimal, cast_from_decimal, cast_to_decimal) into the existing cast/decimal.rs. Code is unchanged apart from pub(crate) on cast_from_decimal and cast_to_decimal.

Are these changes tested?

Covered by existing tests.

Are there any significant user-facing changes?

No.

@github-actions github-actions Bot added arrow Changes to the arrow crate arrow-cast labels Sep 13, 2026
@anandghegde
anandghegde force-pushed the extract-decimal-cast-adapters branch from 99bc867 to 33e20bd Compare September 28, 2026 17:23
/// that exceed the representable range become `INFINITY` or `-INFINITY` without
/// returning an error.
#[inline(always)]
pub fn single_decimal_to_float_lossy<D, F>(f: &F, x: D::Native, scale: i32) -> f64

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for this id prefer to leave it here, since its a public function and its small enough anyway

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in ca44f58: single_decimal_to_float_lossy stays in cast/mod.rs where it was — the definition no longer appears in the diff. Only the private adapters (cast_from_decimal, cast_to_decimal, cast_integer_to_decimal, integer_to_decimal_native) move into the decimal submodule; its call sites reach the helper through the existing use crate::cast::*.

@anandghegde

Copy link
Copy Markdown
Contributor Author

Sounds good — leaving it where it is.

@Jefffrey

Jefffrey commented Oct 3, 2026

Copy link
Copy Markdown
Contributor

Sounds good — leaving it where it is.

was a commit supposed to accompany this comment? i see no changes made

@anandghegde

Copy link
Copy Markdown
Contributor Author

No — no commit was intended there: your inline comment on that thread was preferring to keep it where it is ("for this id prefer to leave it here, since its a public function and its small enough anyway"), and my reply was agreeing with that, so nothing changed. Sorry for the confusion — I could have phrased it as "agreed, keeping it as-is".

@Jefffrey

Jefffrey commented Oct 3, 2026

Copy link
Copy Markdown
Contributor

No — no commit was intended there: your inline comment on that thread was preferring to keep it where it is ("for this id prefer to leave it here, since its a public function and its small enough anyway"), and my reply was agreeing with that, so nothing changed. Sorry for the confusion — I could have phrased it as "agreed, keeping it as-is".

i was commenting on the removal, so my comment was intended to say i want to keep the function where it was

@Jefffrey

Jefffrey commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

see #11076 (comment)

Moves `integer_to_decimal_native`, `integers_fit_digits`,
`cast_integer_to_decimal`, `cast_from_decimal` and `cast_to_decimal` out
of `cast/mod.rs` and into the existing `cast/decimal.rs`, so the decimal
cast code lives in one place.

This is pure code motion: the moved lines are byte-identical to their
definitions on main, and `cast/mod.rs` needs no new declarations because
`use crate::cast::decimal::*;` is already there.

`cast_from_decimal` and `cast_to_decimal` are called from the dispatch
in `cast/mod.rs`, so they become `pub(crate)`. The other three are only
reached from the moved code, so they stay private.

`single_decimal_to_float_lossy` stays in `cast/mod.rs`.
@anandghegde
anandghegde force-pushed the extract-decimal-cast-adapters branch from 7cac0e5 to df86b50 Compare October 16, 2026 13:25
@github-actions github-actions Bot added the arrow-kernels Crates that transform arrow data (e.g. compute, cast) label Oct 16, 2026
@anandghegde

Copy link
Copy Markdown
Contributor Author

Rebased onto main to fix the conflict.

@Jefffrey
Jefffrey added this pull request to the merge queue Oct 27, 2026
@Jefffrey Jefffrey added bug Squash those bugs development-process Internal changes; PRs with this label are excluded from changelog and removed bug Squash those bugs labels Oct 27, 2026
Merged via the queue into apache:main with commit 0e4a501 Oct 27, 2026
37 of 38 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

arrow Changes to the arrow crate arrow-cast arrow-kernels Crates that transform arrow data (e.g. compute, cast) development-process Internal changes; PRs with this label are excluded from changelog

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants