hcrosse opened a new pull request, #1515: URL: https://github.com/apache/arrow-go/pull/1515
### Rationale for this change `Decimal128` and `Decimal256` parsing and formatting panic at scales beyond their multiplier tables. ### What changes are included in this PR? A new internal package, `arrow/internal/pow10`, holds the shared power calculation. `ToBigFloat` and `FromString` use it beyond the tables and retain existing calculations inside them. Scalar string casts use `utils.FormatDecimalG`, matching array output without excessive work at huge scales. Parsing rejects oversized results before conversion and skips unnecessary rounding of tiny values. ### Are these changes tested? `TestDecimalToReal`, `TestFromString`, `TestToBigFloatWithinOneULP`, `TestDecimalScalarStringCastUsesExactScaling`, `TestDecimal128GetOneForMarshal` and `TestDecimal256GetOneForMarshal` cover conversions, parsing, scalar strings and array output. Their new scale cases panic on main and pass with this change. `TestFromString` also limits allocation for tiny results. The tests do not detect removal of the magnitude guards against huge allocations. I measured their memory use separately. With Go 1.26.10, `go 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. Parsing and formatting handle scales beyond the tables without these panics. There is no API change. Closes https://github.com/apache/arrow-go/issues/1507. -- 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]
