You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "alamb (via GitHub)" <gi...@apache.org> on 2025/03/17 19:18:37 UTC

Re: [PR] feat: add rounding logic and scale zero fix parse_decimal to match parse_string_to_decimal_native behavior [arrow-rs]

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


##########
arrow-cast/src/cast/decimal.rs:
##########
@@ -598,7 +599,20 @@ mod tests {
             0_i128
         );
         assert_eq!(
+            parse_decimal::<Decimal128Type>("0", 38, 0)?,
+            parse_string_to_decimal_native::<Decimal128Type>("0", 0)?,

Review Comment:
   Having the same behavior in these two functions seems like a reasonable change to me



##########
arrow-cast/src/parse.rs:
##########
@@ -850,7 +850,16 @@ fn parse_e_notation<T: DecimalType>(
     }
 
     if exp < 0 {
-        result = result.div_wrapping(base.pow_wrapping(-exp as _));
+        let result_with_scale = result.div_wrapping(base.pow_wrapping(-exp as _));

Review Comment:
   does this change the behavior of parsing e notation? If so I didn't see any tests



-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org