hcrosse opened a new pull request, #1513: URL: https://github.com/apache/arrow-go/pull/1513
### Rationale for this change Decimal rescaling can panic or return wrong values, and safe compute casts can discard the error text. ### What changes are included in this PR? `decimal128.Num.Rescale` checks scale differences and overflow, returns zero for zero, and reports `rescale data loss` instead of panicking. `Decimal32.Rescale` and `Decimal64.Rescale` use exact multipliers and signed bounds checks. `Decimal64.ReduceScaleBy` computes its divisor in `int64`. The four decimal cast kernels report the `Rescale` error instead of formatting their previous error output. `TestListScalarHashSupportsChildArraysWithoutScalars` drops its `decimal32` and `decimal64` rows because both types now have scalars. ### Are these changes tested? `TestRescale` in `decimal128`, `TestBasicDecimal128`, `TestDecimalRescale` and `TestDecimalReduceScale` cover panics and wrong results. `TestDecimal128ToInt` covers safe integer casts. `TestDecimal128ToDecimal128`, `TestDecimal128ToDecimal256`, `TestDecimal256ToDecimal128` and `TestDecimal256ToDecimal256` check cast error text. The regression cases panic, return wrong values or report incorrect errors on main. The reproduction now prints the expected output. With Go 1.26.10, `go test -tags assert,test ./arrow/...` with `arrow-testing` and `parquet-testing` checked out, focused `-race -tags assert,test` runs, vet, lint and the Release Audit Tool passed. ### Are there any user-facing changes? Yes. Rescaling returns correct values or errors, and safe cast errors retain their cause. There is no API change. Closes https://github.com/apache/arrow-go/issues/1511. -- 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]
