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 decimals truncates extra digits, but casting them rounds extra digits #9410
parsing the string "1.99" as a scale-1 decimal produces 1.9
casting the scale-2 decimal 1.99 to scale-1 produces 2.0
To Reproduce
// 1.99 -> 1.9 at scale 1, stored as 19assert_eq!(parse_decimal::<Decimal128Type>("1.99",10,1),Ok(19));
vs
let input = Decimal128Array::from(vec![Some(199i128)]).with_precision_and_scale(10,2).unwrap();let out = cast(&input,&DataType::Decimal128(10,1)).unwrap();// 1.99 → 2.0 at scale=1, stored as 20assert_eq!(out.as_primitive::<Decimal128Type>().value(0),20i128);
Expected behavior
It seems like the two operations should have the same behavior, likely 2.0?
Activity
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.