SelfImpr001 commented on code in PR #37732: URL: https://github.com/apache/spark/pull/37732#discussion_r962252317
########## sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/literals.scala: ########## @@ -76,8 +76,19 @@ object Literal { val decimal = Decimal(d) Literal(decimal, DecimalType.fromDecimal(decimal)) case d: JavaBigDecimal => - val decimal = Decimal(d) - Literal(decimal, DecimalType.fromDecimal(decimal)) + Literal(Decimal(d), DecimalType(Math.max(d.precision, d.scale), d.scale())) + if (d.abs().compareTo(new JavaBigDecimal("0")) == 0) { Review Comment: Yes, it is found that it only exists in Spark 2.4 + Hive 1.x, but there are still many people using 2.4 +, it is recommended to provide a patch solution -- 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. To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org