himadripal commented on code in PR #7177:
URL: https://github.com/apache/arrow-rs/pull/7177#discussion_r1966574055
##########
arrow-cast/src/cast/mod.rs:
##########
@@ -8416,92 +8417,92 @@ mod tests {
fn test_parse_string_to_decimal() {
assert_eq!(
Decimal128Type::format_decimal(
- parse_string_to_decimal_native::<Decimal128Type>("123.45",
2).unwrap(),
+ parse_decimal::<Decimal128Type>("123.45", 38, 2).unwrap(),
38,
2,
),
"123.45"
);
assert_eq!(
Decimal128Type::format_decimal(
- parse_string_to_decimal_native::<Decimal128Type>("12345",
2).unwrap(),
+ parse_decimal::<Decimal128Type>("12345", 38, 2).unwrap(),
38,
2,
),
"12345.00"
);
assert_eq!(
Decimal128Type::format_decimal(
- parse_string_to_decimal_native::<Decimal128Type>("0.12345",
2).unwrap(),
+ parse_decimal::<Decimal128Type>("0.12345", 38, 2).unwrap(),
38,
2,
),
"0.12"
);
assert_eq!(
Decimal128Type::format_decimal(
- parse_string_to_decimal_native::<Decimal128Type>(".12345",
2).unwrap(),
+ parse_decimal::<Decimal128Type>(".12345", 38, 2).unwrap(),
38,
2,
),
"0.12"
);
assert_eq!(
Decimal128Type::format_decimal(
- parse_string_to_decimal_native::<Decimal128Type>(".1265",
2).unwrap(),
+ parse_decimal::<Decimal128Type>(".1265", 38, 2).unwrap(),
38,
2,
),
- "0.13"
+ "0.12"
);
assert_eq!(
Decimal128Type::format_decimal(
- parse_string_to_decimal_native::<Decimal128Type>(".1265",
2).unwrap(),
+ parse_decimal::<Decimal128Type>(".1265", 38, 2).unwrap(),
38,
2,
),
- "0.13"
+ "0.12"
Review Comment:
parse_decimal does not support rounding yet. it does truncate instead, fix
is in this PR https://github.com/apache/arrow-rs/pull/7179. This change is put
back in the PR #7179
--
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]