himadripal commented on code in PR #7177:
URL: https://github.com/apache/arrow-rs/pull/7177#discussion_r1966573914


##########
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"
         );
 
         assert_eq!(
             Decimal256Type::format_decimal(
-                parse_string_to_decimal_native::<Decimal256Type>("123.45", 
3).unwrap(),
+                parse_decimal::<Decimal256Type>("123.45", 38, 3).unwrap(),
                 38,
                 3,
             ),
             "123.450"
         );
         assert_eq!(
             Decimal256Type::format_decimal(
-                parse_string_to_decimal_native::<Decimal256Type>("12345", 
3).unwrap(),
+                parse_decimal::<Decimal256Type>("12345", 38, 3).unwrap(),
                 38,
                 3,
             ),
             "12345.000"
         );
         assert_eq!(
             Decimal256Type::format_decimal(
-                parse_string_to_decimal_native::<Decimal256Type>("0.12345", 
3).unwrap(),
+                parse_decimal::<Decimal256Type>("0.12345", 38, 3).unwrap(),
                 38,
                 3,
             ),
             "0.123"
         );
         assert_eq!(
             Decimal256Type::format_decimal(
-                parse_string_to_decimal_native::<Decimal256Type>(".12345", 
3).unwrap(),
+                parse_decimal::<Decimal256Type>(".12345", 38, 3).unwrap(),
                 38,
                 3,
             ),
             "0.123"
         );
         assert_eq!(
             Decimal256Type::format_decimal(
-                parse_string_to_decimal_native::<Decimal256Type>(".1265", 
3).unwrap(),
+                parse_decimal::<Decimal256Type>(".1265", 38, 3).unwrap(),
                 38,
                 3,
             ),
-            "0.127"
+            "0.126"

Review Comment:
   parse_decimal does not support rounding yet. it does truncate instead



-- 
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]

Reply via email to