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


##########
arrow-cast/src/cast/decimal.rs:
##########
@@ -590,43 +590,33 @@ where
 #[cfg(test)]
 mod tests {
     use super::*;
+    use crate::parse::parse_decimal;
 
     #[test]
     fn test_parse_string_to_decimal_native() -> Result<(), ArrowError> {
-        assert_eq!(
-            parse_string_to_decimal_native::<Decimal128Type>("0", 0)?,
-            0_i128
-        );
-        assert_eq!(
-            parse_string_to_decimal_native::<Decimal128Type>("0", 5)?,
-            0_i128
-        );
+        assert_eq!(parse_decimal::<Decimal128Type>("0", 38, 0)?, 0_i128);
+        assert_eq!(parse_decimal::<Decimal128Type>("0", 38, 5)?, 0_i128);
 
+        assert_eq!(parse_decimal::<Decimal128Type>("123", 38, 0)?, 123_i128);
         assert_eq!(
-            parse_string_to_decimal_native::<Decimal128Type>("123", 0)?,
-            123_i128
-        );
-        assert_eq!(
-            parse_string_to_decimal_native::<Decimal128Type>("123", 5)?,
+            parse_decimal::<Decimal128Type>("123", 38, 5)?,
             12300000_i128
         );
 
+        // `parse_decimal` does not handle scale=0 correctly. will enable it 
as part of code change PR.
+        // assert_eq!(parse_decimal::<Decimal128Type>("123.45", 38, 0)?, 
123_i128);

Review Comment:
   parse_decimal does not behave correctly when scale=0 when there are decimal 
digits  in the original string.



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