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

   # Which issue does this PR close?
   
   - Closes #12171.
   - Part of #11421.
   
   # Rationale for this change
   
   #11467 and #12232 added precomputed divisors for every decimal width. This 
PR uses them for decimal `/` and `%` by a scalar, as #12076 did for integers.
   
   # What changes are included in this PR?
   
   - `div` and `rem` of a decimal array by a scalar build a divisor once per 
call: `DivisorI32` for `Decimal32`, `DivisorI64` for `Decimal64`, `DivisorI128` 
for `Decimal128`, and `DivisorI256` for `Decimal256`.
   - For `Decimal128` and `Decimal256`, a batch whose scaled values, divisor, 
and scale multiplier all fit in the next narrower type divides with 
`DivisorI64` or `DivisorI128`. A scan of the values, including null slots, 
decides.
   - An array that is at most half null divides every slot with `unary`, and 
one that is more than half null divides only its valid values with `try_unary`, 
as in #12076.
   - An array with a value that overflows when scaled, a null scalar, and a 
divisor of 0 or -1 take the existing kernel, so results and errors don't change.
   - On the `unary` path, null slots of the result hold the quotient or 
remainder of the input's null slot instead of zero, as they do in #12076.
   - e3c67be20c adds cases to the `decimal_division` benchmark with half, three 
quarters, and nine tenths of the values null, so the benchmark bot can compare 
against it.
   
   # Are these changes tested?
   
   `test_decimal_div_rem_by_scalar` and `test_decimal_div_rem_by_scalar_bounds` 
in `arrow-arith/src/numeric.rs`.
   
   # Are there any significant user-facing changes?
   
   No.
   
   # AI usage disclosure
   
   I wrote this PR with help from Claude but understand and support the core 
approach, implementation, and test coverage.
   


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