maropu 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_r312695782
##########
File path:
sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/ArithmeticExpressionSuite.scala
##########
@@ -405,6 +405,21 @@ 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)
+ }
+ withSQLConf(SQLConf.LEGACY_INTEGRALDIVIDE_RETURN_LONG.key -> "true") {
Review comment:
We need to support decimals for this divide in the legacy mode, too?
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]