TJX2014 commented on a change in pull request #28926:
URL: https://github.com/apache/spark/pull/28926#discussion_r447536856
##########
File path:
sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/CollectionExpressionsSuite.scala
##########
@@ -1854,4 +1854,18 @@ class CollectionExpressionsSuite extends SparkFunSuite
with ExpressionEvalHelper
Literal(stringToInterval("interval 1 year"))),
Seq(Date.valueOf("2018-01-01")))
}
+
+ test("SPARK-32133: Sequence step must be a day interval " +
+ "if start and end values are dates") {
+ checkExceptionInExpression[IllegalArgumentException](Sequence(
+ Cast(Literal("2011-03-01"), DateType),
+ Cast(Literal("2011-04-01"), DateType),
+ Option(Literal(stringToInterval("interval 1 hour")))), null,
+ "sequence step must be a day interval if start and end values are dates")
+ checkEvaluation(Sequence(
+ Cast(Literal("2011-03-01"), DateType),
+ Cast(Literal("2011-03-02"), DateType),
+ Option(Literal(stringToInterval("interval 1 day")))),
+ Seq(Date.valueOf("2011-03-01"), Date.valueOf("2011-03-02")))
Review comment:
@cloud-fan Thank you for your suggestion, I have done. Besides, I add a
positive test case, hope this could be better.
----------------------------------------------------------------
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]