martin-g commented on code in PR #8700:
URL: https://github.com/apache/arrow-rs/pull/8700#discussion_r2459835602
##########
arrow-cast/src/parse.rs:
##########
@@ -2752,6 +2761,23 @@ mod tests {
let result = parse_decimal::<Decimal256Type>(s, 76, scale);
assert_eq!(i, result.unwrap());
}
+
+ let zero_scale_tests = [
Review Comment:
```suggestion
let zero_scale_tests = [
("0.123", 0),
```
##########
arrow-cast/src/parse.rs:
##########
@@ -963,6 +963,14 @@ pub fn parse_decimal<T: DecimalType>(
}
if !is_e_notation {
+ if scale == 0 && fractionals > 0 {
+ // The input string contained some fractional digits after the
decimal point despite
+ // the scale being zero. Eject all the fractional digits from the
number.
+ result = result.div_wrapping(base.pow_wrapping(fractionals as _));
Review Comment:
Would this be correct if there are many fractional digits, e.g. 20+ ?!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]