Skip to content

Commit d857ec3

Browse files
committed
add null check in DateExpressionSuite
1 parent b7f5411 commit d857ec3

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/DateExpressionsSuite.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ class DateExpressionsSuite extends SparkFunSuite with ExpressionEvalHelper {
106106
}
107107
}
108108
}
109+
checkEvaluation(DayOfYear(Literal.create(null, DateType)), null)
109110
}
110111

111112
test("Year") {
@@ -274,6 +275,7 @@ class DateExpressionsSuite extends SparkFunSuite with ExpressionEvalHelper {
274275
checkEvaluation(LastDay(Literal(Date.valueOf("2015-12-05"))), Date.valueOf("2015-12-31"))
275276
checkEvaluation(LastDay(Literal(Date.valueOf("2016-01-06"))), Date.valueOf("2016-01-31"))
276277
checkEvaluation(LastDay(Literal(Date.valueOf("2016-02-07"))), Date.valueOf("2016-02-29"))
278+
checkEvaluation(LastDay(Literal.create(null, DateType)), null)
277279
}
278280

279281
test("next_day") {

0 commit comments

Comments
 (0)