mgaido91 commented on a change in pull request #25010: [SPARK-28201][SQL] 
Revisit MakeDecimal behavior on overflow
URL: https://github.com/apache/spark/pull/25010#discussion_r303602760
 
 

 ##########
 File path: sql/catalyst/src/main/scala/org/apache/spark/sql/types/Decimal.scala
 ##########
 @@ -111,9 +111,10 @@ final class Decimal extends Ordered[Decimal] with 
Serializable {
    */
   def set(decimal: BigDecimal, precision: Int, scale: Int): Decimal = {
     this.decimalVal = decimal.setScale(scale, ROUND_HALF_UP)
-    require(
-      decimalVal.precision <= precision,
-      s"Decimal precision ${decimalVal.precision} exceeds max precision 
$precision")
+    if (decimalVal.precision > precision) {
+      throw new ArithmeticException(
+        s"Decimal precision ${decimalVal.precision} exceeds max precision 
$precision")
 
 Review comment:
   Thanks @dongjoon-hyun , sorry for the trouble. I hadn't run integration 
tests indeed.

----------------------------------------------------------------
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]

Reply via email to