Skip to content

fix(arrow): validate precision in NewDecimalType - #1162

Draft
fallintoplace wants to merge 1 commit into
apache:mainfrom
fallintoplace:fix/decimal-type-precision
Draft

fix(arrow): validate precision in NewDecimalType#1162
fallintoplace wants to merge 1 commit into
apache:mainfrom
fallintoplace:fix/decimal-type-precision

Conversation

@fallintoplace

Copy link
Copy Markdown
Contributor

Rationale for this change

NewDecimalType only checks maximum precision with debug assertions and does not reject zero precision. Normal builds can therefore create invalid decimal types.

What changes are included in this PR?

Validate that precision is between 1 and the maximum supported by the requested decimal type, and return arrow.ErrInvalid otherwise.

Are these changes tested?

Yes. The tests cover the lower and upper valid boundaries plus zero and overflow precision for all four decimal widths. The full arrow package suite passes.

Are there any user-facing changes?

NewDecimalType now returns an error for invalid precision instead of constructing an invalid type.

@fallintoplace
fallintoplace force-pushed the fix/decimal-type-precision branch from 7cbb6c5 to 8ac32a0 Compare August 9, 2026 22:51
@fallintoplace
fallintoplace marked this pull request as ready for review August 9, 2026 22:51
@fallintoplace
fallintoplace marked this pull request as draft August 9, 2026 22:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant