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

   # Which issue does this PR close?
   
   Closes #10978.
   
   # Rationale for this change
   
   Valid negative decimal scales can overflow `i8` precision/scale 
calculations, causing debug panics or incorrect metadata and cast fast-path 
selection when overflow checks are disabled.
   
   # What changes are included in this PR?
   
   - Compute add/subtract/remainder precision and scale differences in `i16`, 
clamping precision before narrowing.
   - Reject unrepresentable multiplication scales and overflowing remainder 
alignment factors.
   - Widen decimal cast scale differences and precision checks while preserving 
existing rounding, nulls, and safe/unsafe cast behavior.
   
   # Are these changes tested?
   
   The six new regression tests fail on current `main` before the fix.
   
   - `cargo +stable test -p arrow-arith -p arrow-cast --lib`: 623 passed.
   - `cargo +stable --config 
'profile.test.package.arrow-arith.overflow-checks=false' --config 
'profile.test.package.arrow-cast.overflow-checks=false' test -p arrow-arith -p 
arrow-cast --lib decimal256 --verbose`: 31 passed. This is an unchecked test 
profile, not an optimized release build.
   - `cargo +stable fmt --all -- --check` and `git diff --check`: passed.
   - `cargo +stable clippy -p arrow-arith -p arrow-cast --lib --tests --no-deps 
-- -D warnings -A clippy::chunks_exact_to_as_chunks`: passed.
   
   Local checks used Rust 1.98.0 on Windows because the installed 
repository-pinned 1.97.1 toolchain was incomplete. Strict Clippy first reported 
the new `chunks_exact_to_as_chunks` lint in unchanged `arrow-buffer` and 
`arrow-arith/src/aggregate.rs` code. The scoped run allows only that lint; the 
repository's existing removed-lint configuration also emits a compatibility 
warning. No source or lint configuration was changed for these diagnostics.
   
   # Are there any user-facing changes?
   
   Affected addition, subtraction, multiplication, remainder, and decimal casts 
now return correctly calculated results or checked errors for extreme negative 
scales instead of panicking or wrapping metadata. Public API signatures are 
unchanged.
   
   AI assistance: OpenAI Codex (GPT-6) generated the implementation, regression 
tests, and this description. Codex agents reviewed the diff and ran the checks 
listed 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