VanshajPoonia opened a new pull request, #12459:
URL: https://github.com/apache/arrow-rs/pull/12459

   # Which issue does this PR close?
   
   - Closes #11605
   
   # Rationale for this change
   
   See #11605. When product_scale minus required_scale is 77 or more, 
10^exponent does not fit in an i256 and wraps, so a zero product comes back as 
1. Past 127 the exponent overflows an i8 and panics in debug builds.
   
   # What changes are included in this PR?
   
   get_fixed_point_info computes the exponent as an i16 and returns the divisor 
only when it is at most 76. Above that both functions return zeros. Nulls stay 
null. The doc comments say so.
   
   # Are these changes tested?
   
   test_decimal_multiply_fixed_point_required_scale_far_below_product_scale 
covers scale -76 (rounds to 3), -77, -100, -128, the i8 overflow case, a null 
slot and both functions. It fails on main. cargo test -p arrow-arith, fmt, 
clippy and doc pass. I did not run typos or the workspace tests.
   
   # Are there any significant user-facing changes?
   
   Calls with a required scale far below the product scale now return zeros 
instead of wrong values or a panic.
   
   # AI usage disclosure
   
   AI usage: I used an Claude Code to draft the change and this description. I 
have gone through every line manually and ran the checks above.
   


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