dongjoon-hyun commented on a change in pull request #25144: [SPARK-28369][SQL]
Honor spark.sql.decimalOperations.nullOnOverflow in ScalaUDF result
URL: https://github.com/apache/spark/pull/25144#discussion_r303254184
##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/types/Decimal.scala
##########
@@ -414,20 +414,12 @@ final class Decimal extends Ordered[Decimal] with
Serializable {
def floor: Decimal = if (scale == 0) this else {
val newPrecision = DecimalType.bounded(precision - scale + 1, 0).precision
- val res = toPrecision(newPrecision, 0, ROUND_FLOOR)
- if (res == null) {
- throw new AnalysisException(s"Overflow when setting precision to
$newPrecision")
- }
- res
Review comment:
So, do you want change the user facing message in the same
`AnalysisException`, right?
From `Overflow when setting precision to $newPrecision` to `$toDebugString
cannot be represented as Decimal($precision, $scale)`?
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]