cloud-fan commented on a change in pull request #26995: [SPARK-30341][SQL]
Overflow check for interval arithmetic operations
URL: https://github.com/apache/spark/pull/26995#discussion_r362402624
##########
File path:
sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/IntervalExpressionsSuite.scala
##########
@@ -197,10 +198,22 @@ class IntervalExpressionsSuite extends SparkFunSuite
with ExpressionEvalHelper {
}
test("multiply") {
- def check(interval: String, num: Double, expected: String): Unit = {
- checkEvaluation(
- MultiplyInterval(Literal(stringToInterval(interval)), Literal(num)),
- if (expected == null) null else stringToInterval(expected))
+ def check(
+ interval: String,
+ num: Double,
+ expected: String,
+ checkException: Boolean = false): Unit = {
+ Seq("true", "false").foreach { v =>
+ withSQLConf(SQLConf.ANSI_ENABLED.key -> v) {
+ if (checkException) {
+ checkExceptionInExpression[ArithmeticException](
+ MultiplyInterval(Literal(stringToInterval(interval)),
Literal(num)), expected)
+ } else {
+
checkEvaluation(MultiplyInterval(Literal(stringToInterval(interval)),
Literal(num)),
+ if (expected == null) null else stringToInterval(expected))
Review comment:
can `expected` be null?
----------------------------------------------------------------
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]