You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Parsing Decimal With Negative Exponent And Zero Scale Can Overflow #5762
let v = parse_decimal::<Decimal128Type>("99999999999999999999999999999999999999", 38, 0).unwrap();
assert_eq!(v, 99999999999999999999999999999999999999);
But if we add an additional 9 followed by e-1 we get overflow
let v = parse_decimal::<Decimal128Type>("999999999999999999999999999999999999999e-1", 38, 0).unwrap();
assert_eq!(v, 99999999999999999999999999999999999999);
changed the title [-]Parsing Decimal With Negative Exponent Can Overflow[/-][+]Parsing Decimal With Negative Exponent And Zero Scale Can Overflow[/+]on May 13, 2024
Closed via #10850. The parser now handles oversized mantissas with negative exponents when the rounded result fits the target precision.
The original repro still returns an error, correctly under the new rounding semantics: the value is 38 nines followed by .9, which rounds to 10^38 at scale 0 and exceeds precision 38. The expected result in this issue assumed truncation. #10850 adds regression coverage for both representable results and this rounding-overflow case:
Activity
[-]Parsing Decimal With Negative Exponent Can Overflow[/-][+]Parsing Decimal With Negative Exponent And Zero Scale Can Overflow[/+]alamb commentedon May 13, 2024
@yjshen would you be willing to look into this issue?
yjshen commentedon May 13, 2024
Yes, I'll look into this.
ByteBaker commentedon Oct 10, 2024
@yjshen any update on this?
neilconway commentedon Aug 21, 2026
take
Consolidate string-to-decimal parsing into a single code path
fix: Consolidate string-to-decimal parsing into a single code path (#…
fix: Consolidate string-to-decimal parsing into a single code path (a…
fix: Consolidate string-to-decimal parsing into a single code path (a…
fix: Consolidate string-to-decimal parsing into a single code path (a…
sdf-jkl commentedon Sep 30, 2026
Closed via #10850. The parser now handles oversized mantissas with negative exponents when the rounded result fits the target precision.
The original repro still returns an error, correctly under the new rounding semantics: the value is 38 nines followed by .9, which rounds to 10^38 at scale 0 and exceeds precision 38. The expected result in this issue assumed truncation. #10850 adds regression coverage for both representable results and this rounding-overflow case:
arrow-rs/arrow-cast/src/parse.rs
Lines 2899 to 2916 in 70219af
ByteBaker commentedon Oct 31, 2026
Happy to see this finally closed. Kudos and thanks @neilconway 🙌