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


##########
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(),

Review Comment:
   This test is now testing a different function. I am not familar with the 
difference betwen parse_string_to_decimal and parse_decima



##########
arrow-cast/src/cast/decimal.rs:
##########
@@ -590,43 +590,34 @@ 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);
         assert_eq!(
-            parse_string_to_decimal_native::<Decimal128Type>("123.45", 0)?,
-            123_i128
-        );
-        assert_eq!(
-            parse_string_to_decimal_native::<Decimal128Type>("123.45", 5)?,
+            parse_decimal::<Decimal128Type>("123.45", 38, 5)?,
             12345000_i128
         );
 
-        assert_eq!(
-            parse_string_to_decimal_native::<Decimal128Type>("123.4567891", 
0)?,
+        //scale = 0 is not handled correctly in parse_decimal, next PR will 
fix it and enable this.

Review Comment:
   Doens't this comment out existing tests? Why would you reduce test coverage?



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