viirya commented on a change in pull request #26881: [SPARK-30252][SQL] Disallow negative scale of Decimal under ansi mode URL: https://github.com/apache/spark/pull/26881#discussion_r365484980
########## File path: sql/catalyst/src/main/scala/org/apache/spark/sql/types/Decimal.scala ########## @@ -134,10 +137,14 @@ final class Decimal extends Ordered[Decimal] with Serializable { // result. For example, the precision of 0.01 equals to 1 based on the definition, but // the scale is 2. The expected precision should be 3. this._precision = decimal.scale + 1 + this._scale = decimal.scale + } else if (decimal.scale < 0 && !SQLConf.get.allowNegativeScaleOfDecimalEnabled) { + this._precision = decimal.precision - decimal.scale + this._scale = 0 Review comment: Do you mean allowing negative scale here? ---------------------------------------------------------------- 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: us...@infra.apache.org With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org