Shell-aurum commented on code in PR #1707:
URL: https://github.com/apache/arrow-go/pull/1707#discussion_r4758525988
##########
arrow/decimal/decimal.go:
##########
@@ -198,13 +198,11 @@ func fromDecimalLiteral[T interface {
Decimal32 | Decimal64
FitsInPrecision(int32) bool
}](lit decimalstr.Parsed, prec, scale int32, nbits uint) (n T, err error) {
- if scale < 0 {
- // Check the unscaled magnitude before using the scale,
matching the
- // previous MantExp > nbits bound (|x| >= 2^nbits).
- if lit.AtLeastTwoPower(0, int(nbits)) {
- return n, fmt.Errorf("bitlen too large for decimal%d",
nbits)
- }
- } else if lit.AtLeastTwoPower(int64(scale), int(nbits)) {
+ maxScale := MaxScale[T]()
Review Comment:
You were right—the MaxScale[T]() check was incorrect for Decimal32 and
Decimal64. I removed it and the range-error test, restored coverage for scales
outside +- MaxScale, and added a regression case for 1e1000000000 at scale
-1e9. I kept the decimal128/decimal256 validation-order changes and the
simplified magnitude checks. The update is pushed in commit 627eac4.
I haven’t rerun the Go tests yet because Go isn’t installed in my
environment.
--
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]