cloud-fan commented on a change in pull request #25136: [SPARK-28322][SQL] Add support to Decimal type for integral divide URL: https://github.com/apache/spark/pull/25136#discussion_r315518559
########## File path: sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/ArithmeticExpressionSuite.scala ########## @@ -405,6 +406,28 @@ class ArithmeticExpressionSuite extends SparkFunSuite with ExpressionEvalHelper assert(ctx2.inlinedMutableStates.size == 1) } + test("SPARK-28322: IntegralDivide supports decimal type") { + withSQLConf(SQLConf.LEGACY_INTEGRALDIVIDE_RETURN_LONG.key -> "false") { + checkEvaluation(IntegralDivide(Literal(Decimal(1)), Literal(Decimal(2))), Decimal(0)) + checkEvaluation(IntegralDivide(Literal(Decimal(1.4)), Literal(Decimal(0.6))), Decimal(2)) + checkEvaluation(IntegralDivide(Literal(Decimal(1.2)), Literal(Decimal(1.1))), Decimal(1)) + checkEvaluation(IntegralDivide(Literal(Decimal(1.2)), Literal(Decimal(0.0))), null) + checkEvaluation(DecimalPrecision.decimalAndDecimal.apply(IntegralDivide( + Literal(Decimal("99999999999999999999999999999999999")), Literal(Decimal(0.001)))), Review comment: if we add more digits, can this overflow? ---------------------------------------------------------------- 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