You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2020/09/11 16:25:59 UTC

[GitHub] [spark] gengliangwang commented on a change in pull request #29731: [WIP][SPARK-32706][SQL] Improve cast string to decimal type

gengliangwang commented on a change in pull request #29731:
URL: https://github.com/apache/spark/pull/29731#discussion_r487154730



##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/types/Decimal.scala
##########
@@ -143,8 +143,12 @@ final class Decimal extends Ordered[Decimal] with Serializable {
     } else if (decimal.scale < 0 && !SQLConf.get.allowNegativeScaleOfDecimalEnabled) {
       this._precision = decimal.precision - decimal.scale
       this._scale = 0
-      // set scale to 0 to correct unscaled value
-      this.decimalVal = decimal.setScale(0)
+      if (this._precision > 309) {

Review comment:
       I think the max precision is DecimalType.MAX_PRECISION (38)
   




----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org