Skip to content

Commit

Permalink
move test case to Sequence of dates
Browse files Browse the repository at this point in the history
  • Loading branch information
TJX2014 committed Jun 30, 2020
1 parent 3e28461 commit 24384c9
Showing 1 changed file with 7 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -933,6 +933,13 @@ class CollectionExpressionsSuite extends SparkFunSuite with ExpressionEvalHelper
Literal(negateExact(stringToInterval("interval 1 month")))),
EmptyRow,
s"sequence boundaries: 0 to 2678400000000 by -${28 * MICROS_PER_DAY}")

// 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")
}
}

Expand Down Expand Up @@ -1854,18 +1861,4 @@ 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")))
}
}

0 comments on commit 24384c9

Please sign in to comment.