Repository navigation
fix(arrow-array): keep precision and scale in null_if_overflow_precision - #12242
Merged
Merged
Conversation
Rich-T-kid
approved these changes
Nov 14, 2026
Contributor
|
thanks @dayan02dev |
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?
null_if_overflow_precisionresets decimal precision and scale, changing valid values #11300Rationale for this change
null_if_overflow_precisionreturned the default type of the decimal width instead of the input's type. ADecimal128(2, 1)holding9.9came back asDecimal128(38, 10)and read as0.0000000099. All four decimal widths behave this way, because the result is built throughunary_opt, which usesT::DATA_TYPE. #11310 and #11321 fixed the same kind of bug.What changes are included in this PR?
unary_optresult with.with_data_type(self.data_type().clone()), asinto_builderdoes since fix(arrow-array): preserve type params inPrimitiveArray::into_builder#11321.Are these changes tested?
Yes.
test_null_if_overflow_precision_keeps_data_typecovers Decimal32/64/128/256 at(2, 1). Without the fix it fails withDecimal32(9, 2)vsDecimal32(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.