Skip to content

fix(arrow-array): keep precision and scale in null_if_overflow_precision - #12242

Merged
Rich-T-kid merged 3 commits into
apache:mainfrom
dayan02dev:fix/11300
Nov 14, 2026
Merged

Rich-T-kid merged 3 commits into
apache:mainfrom
dayan02dev:fix/11300

Conversation

@dayan02dev

Copy link
Copy Markdown
Contributor

Which issue does this PR close?

Rationale for this change

null_if_overflow_precision returned the default type of the decimal width instead of the input's type. A Decimal128(2, 1) holding 9.9 came back as Decimal128(38, 10) and read as 0.0000000099. All four decimal widths behave this way, because the result is built through unary_opt, which uses T::DATA_TYPE. #11310 and #11321 fixed the same kind of bug.

What changes are included in this PR?

Are these changes tested?

Yes. test_null_if_overflow_precision_keeps_data_type covers Decimal32/64/128/256 at (2, 1). Without the fix it fails with Decimal32(9, 2) vs Decimal32(2, 1).

Are there any significant user-facing changes?

The output data type now matches the input, including precision and scale. Which values get nulled is unchanged. Callers that re-applied the type afterwards (for example with .with_precision_and_scale(..)) keep working.

AI usage disclosure

The patch and test were written with an AI coding agent (Claude Code). It reproduced the issue on main, ran fmt, clippy, the arrow-array tests (including release mode) and typos, and a separate agent session re-checked the fix against all four decimal widths, nulls, slices and the precision bounds before I submitted it.

@boring-cyborg boring-cyborg Bot added the arrow-core Core crates related to representing arrow data label Nov 13, 2026
@Rich-T-kid

Copy link
Copy Markdown
Contributor

thanks @dayan02dev

@Rich-T-kid
Rich-T-kid added this pull request to the merge queue Nov 14, 2026
Merged via the queue into apache:main with commit f358c6d Nov 14, 2026
22 checks passed
@Rich-T-kid Rich-T-kid added the bug Squash those bugs label Nov 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

arrow-core Core crates related to representing arrow data bug Squash those bugs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

null_if_overflow_precision resets decimal precision and scale, changing valid values

2 participants