Phoenix500526 opened a new pull request, #12104: URL: https://github.com/apache/arrow-rs/pull/12104
# Which issue does this PR close? - Closes #12103 # Rationale for this change `try_new_with_signed_scale(1, i8::MIN)` panics when integer overflow checks are enabled because negating the scale overflows `i8` before the checked rescaling operations run. The unrepresentable value should instead reach the existing overflow error path, as it does in default release builds. # What changes are included in this PR? Use `scale.unsigned_abs()` and widen the exponent to `u32` in the shared Variant decimal implementation. The existing checked power, checked multiplication and error handling remain unchanged. # Are these changes tested? A regression test covers `VariantDecimal4`, `VariantDecimal8` and `VariantDecimal16`. It checks that scales -128 and -127 return an error, and that ordinary negative-scale conversions preserve positive and negative values correctly. The test panicked on the old debug implementation and passes after the fix in both debug and release builds. The full workspace tests, all-features Clippy, formatting and spelling checks passed locally. # Are there any significant user-facing changes? No public API changes. AI assistance: OpenAI Codex assisted with investigation, implementation, the regression test, validation and this PR description. -- 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]
