gruuya commented on code in PR #8700:
URL: https://github.com/apache/arrow-rs/pull/8700#discussion_r2697159027
##########
arrow-cast/src/parse.rs:
##########
@@ -2752,6 +2740,35 @@ mod tests {
let result = parse_decimal::<Decimal256Type>(s, 76, scale);
assert_eq!(i, result.unwrap());
}
+
+ let zero_scale_tests = [
+ ("0.123", 0, 3),
+ ("1.0", 1, 3),
+ ("1.2", 1, 3),
+ ("1.00", 1, 3),
+ ("1.23", 1, 3),
+ ("1.000", 1, 3),
+ ("1.123", 1, 3),
+ ("123.0", 123, 3),
+ ("123.4", 123, 3),
+ ("123.00", 123, 3),
+ ("123.45", 123, 3),
+ ("123.000000000000000000004", 123, 3),
+ ("0.123e2", 12, 3),
+ ("0.123e4", 1230, 10),
+ ("1.23e4", 12300, 10),
+ ("12.3e4", 123000, 10),
+ ("123e4", 1230000, 10),
+ (
+ "20000000000000000000000000000000000002.0",
+ 20000000000000000000000000000000000002,
+ 38,
+ ),
+ ];
+ for (s, i, precision) in zero_scale_tests {
+ let result_128 = parse_decimal::<Decimal128Type>(s, precision,
0).unwrap();
+ assert_eq!(i, result_128);
+ }
Review Comment:
Nice, I've appended these cases to unsupported check and test cases.
--
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]