yaooqinn 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_r362374933
##########
File path:
sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/IntervalExpressionsSuite.scala
##########
@@ -211,14 +222,17 @@ class IntervalExpressionsSuite extends SparkFunSuite
with ExpressionEvalHelper {
check("-100 years -1 millisecond", 0.5, "-50 years -500 microseconds")
check("2 months 4 seconds", -0.5, "-1 months -2 seconds")
check("1 month 2 microseconds", 1.5, "1 months 15 days 3 microseconds")
- check("2 months", Int.MaxValue, null)
+ check("2 months", Int.MaxValue, CalendarInterval.MAX_VALUE.toString,
checkException = true)
}
test("divide") {
def check(interval: String, num: Double, expected: String): Unit = {
- checkEvaluation(
- DivideInterval(Literal(stringToInterval(interval)), Literal(num)),
- if (expected == null) null else stringToInterval(expected))
+ Seq("true", "false").foreach { v =>
+ withSQLConf(SQLConf.ANSI_ENABLED.key -> v) {
+ checkEvaluation(DivideInterval(Literal(stringToInterval(interval)),
Literal(num)),
+ if (expected == null) null else stringToInterval(expected))
Review comment:
yes, I will add a check for this.
----------------------------------------------------------------
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]