scovich opened a new issue, #9410:
URL: https://github.com/apache/arrow-rs/issues/9410

   **Describe the bug**
   
   Best I can tell from the code:
   * parsing the string `"1.99"` as a scale-1 decimal produces `1.9`
   * casting the scale-2 decimal `1.99` to scale-1 produces `2.0`
   
   **To Reproduce**
   
   ```rust
   // 1.99 -> 1.9 at scale 1, stored as 19
   assert_eq!(parse_decimal::<Decimal128Type>("1.99", 10, 1), Ok(19));
   ```
   vs
   ```rust
   let input = Decimal128Array::from(vec![Some(199i128)])
       .with_precision_and_scale(10, 2)
       .unwrap();
   let out = cast(&input, &DataType::Decimal128(10, 1)).unwrap();
   
   // 1.99 → 2.0 at scale=1, stored as 20
   assert_eq!(out.as_primitive::<Decimal128Type>().value(0), 20i128);
   ```
   
   **Expected behavior**
   
   It seems like the two operations should have the same behavior, likely `2.0`?
   
   **Additional context**
   
   Rabbit-hole off of 
https://github.com/apache/arrow-rs/pull/8700#issuecomment-3897948966


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