L. C. Hsieh created SPARK-60205:
-----------------------------------

             Summary: Decimal.set(unscaled, precision, scale) reports the 
previous value instead of the rejected one on overflow
                 Key: SPARK-60205
                 URL: https://issues.apache.org/jira/browse/SPARK-60205
             Project: Spark
          Issue Type: Bug
          Components: SQL
    Affects Versions: 5.0.0
            Reporter: L. C. Hsieh


`Decimal.set(unscaled: Long, precision: Int, scale: Int)` throws 
`unscaledValueTooLargeForPrecisionError(this, precision, scale)` after 
`setOrNull` returns null. `setOrNull` returns before writing any field, so 
`this` still holds its previous value, which is 0 for a new `Decimal`. For 
example, `Decimal(123456L, 3, 0)` throws "0 cannot be represented as Decimal(3, 
0)". Callers include `MakeDecimal` under ANSI and 
`AvroDeserializer.createDecimal`. The error should build the value from 
`unscaled` and `scale`.

Found in the review of SPARK-60119.




--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to