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

   # Which issue does this PR close?
   
   - Closes #12095
   
   # Rationale for this change
   
   `validate_decimal_precision` rejects valid decimal arrays with a negative 
scale because casting the scale to `u8` makes it a large positive number. For 
example, an array storing `1` with precision 5 and scale -2 represents 100, but 
validation incorrectly reports that precision 5 is less than scale -2.
   
   # What changes are included in this PR?
   
   Only compare scale against precision when scale is positive, matching 
`validate_decimal_precision_and_scale`. The per-value precision checks remain 
unchanged.
   
   # Are these changes tested?
   
   A regression test covers Decimal32, Decimal64, Decimal128 and Decimal256 
with negative scales (including `i8::MIN`), zero and positive scales, nulls, 
and values at the precision boundaries. It also verifies that out-of-range 
values and positive scales exceeding the requested precision still fail. The 
test failed before the fix and passed afterward. The full workspace test suite, 
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 the implementation, regression 
test, validation and 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]

Reply via email to