Github user wojtek-szymanski commented on a diff in the pull request: https://github.com/apache/spark/pull/17075#discussion_r103864736 --- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/types/Decimal.scala --- @@ -362,17 +374,13 @@ final class Decimal extends Ordered[Decimal] with Serializable { def abs: Decimal = if (this.compare(Decimal.ZERO) < 0) this.unary_- else this def floor: Decimal = if (scale == 0) this else { - val value = this.clone() - value.changePrecision( - DecimalType.bounded(precision - scale + 1, 0).precision, 0, ROUND_FLOOR) - value + toPrecision(DecimalType.bounded(precision - scale + 1, 0).precision, 0, ROUND_FLOOR) + .getOrElse(clone()) --- End diff -- You're right, thanks. My suggestion is to raise an internal error if setting new precision in `floor` or `ceil` would fail.
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org