Shell-aurum commented on code in PR #1707:
URL: https://github.com/apache/arrow-go/pull/1707#discussion_r4752058464
##########
arrow/decimal128/decimal128.go:
##########
@@ -248,9 +248,9 @@ func FromString(v string, prec, scale int32) (n Num, err
error) {
func fromDecimalLiteral(lit decimalstr.Parsed, prec, scale int32) (n Num, err
error) {
if scale < 0 {
- // Reject an unscaled magnitude that would not fit in signed
128-bit
- // storage, before using the scale.
- if lit.AtLeastTwoPower(0, 127) {
+ // Check the magnitude after applying the negative scale: a
large
+ // literal can scale down to a value that fits.
+ if lit.AtLeastTwoPower(int64(scale), 127) {
Review Comment:
Thanks for the review. I’ve updated the PR to validate scale ranges for
decimal32 and decimal64, run scale validation before magnitude checks across
all decimal widths, and simplify the shared magnitude check. I also added
regression tests for large literals and out-of-range scales. The changes are
pushed to the existing PR branch.
--
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]