shihchengwei-lab commented on PR #12459:
URL: https://github.com/apache/arrow-rs/pull/12459#issuecomment-7210346382

   On `8e910c77`, `multiply_fixed_point_checked` succeeds and returns `[0]` in 
a release build when both input scales are `-80` and the requested scale is 
`-100`. The product scale is `-160`, so the requested scale is greater than the 
product scale and the API should return an error.
   
   Save this as `arrow-arith/tests/scale_sum.rs` and run `cargo test --release 
-p arrow-arith --test scale_sum`.
   
   ```rust
   use arrow_arith::arithmetic::multiply_fixed_point_checked;
   use arrow_array::Decimal128Array;
   
   #[test]
   fn rejects_required_scale_above_product_scale() {
       let a = Decimal128Array::from(vec![1_i128])
           .with_precision_and_scale(1, -80)
           .unwrap();
   
       assert!(multiply_fixed_point_checked(&a, &a, -100).is_err());
   }
   ```
   
   The input scales are still added as `i8`, so `-160` wraps to `96` before the 
subtraction. The parent commit panics on this input. The PR reaches the new 
zero-result branch and returns success.
   
   Could you convert both input scales to `i16` before adding them and include 
this case in the regression test?
   
   I used AI assistance for the review, test, and wording, and verified the 
behavior on both commits in an isolated environment.
   


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