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

   **Describe the bug**
   Multiplication for decimals is wrong for decimals 
   
   **To Reproduce**
   <!--
   Steps to reproduce the behavior:
   -->
   
   ```
       #[test]
       fn test_decimal_multiplication() {
           let a = 
Decimal128Array::from_iter_values([1]).with_precision_and_scale(1, 1).unwrap();
           
           let b = 
Decimal128Array::from_iter_values([1]).with_precision_and_scale(1, 1).unwrap();
   
           let e = 
Decimal128Array::from_iter_values([1]).with_precision_and_scale(2, 2).unwrap();
           let r = multiply(&a, &b).unwrap();
           assert_eq!(e, r);
       }
   ```
   0.1 * 0.1 should return 0.01.
   
   The current kernel just multiplies the raw integers but ignores the 
scale/precision values of the.
   
   ```
     left: `PrimitiveArray<Decimal128(2, 2)>
   [
     1,
   ]`,
    right: `PrimitiveArray<Decimal128(38, 10)>
   [
     1,
   ]`', arrow-arith/src/arithmetic.rs:2958:9
   
   ```
   
   **Expected behavior**
   The kernel should add scale as well, values 0.1 * 0.1 should have primitive 
value `1` with scale `2`.
   
   **Additional context**
   <!--
   Add any other context about the problem here.
   -->


-- 
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-unsubscr...@arrow.apache.org.apache.org

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

Reply via email to