cloud-fan commented on a change in pull request #29882:
URL: https://github.com/apache/spark/pull/29882#discussion_r513563441
##########
File path:
sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/ArithmeticExpressionSuite.scala
##########
@@ -500,4 +524,53 @@ class ArithmeticExpressionSuite extends SparkFunSuite with
ExpressionEvalHelper
checkEvaluation(e6, 0.toByte)
}
}
+
+ private def testDecimalAndLongType(testFunc: (Int => Any) => Unit): Unit = {
+ testFunc(_.toLong)
+ testFunc(Decimal(_))
+ }
+
+ test("SPARK-33008: division by zero on divide-like operations returns
incorrect result") {
+ withSQLConf(SQLConf.ANSI_ENABLED.key -> "true") {
+ testDecimalAndDoubleType { convert =>
Review comment:
we can simplify the test
```
val operators: Seq[(Expression, Expression) => Expression] = Seq(Divide(_,
_), ...)
oeprators.foreach { operator =>
testDecimalAndDoubleType ...
}
```
----------------------------------------------------------------
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]