@@ -60,6 +60,8 @@ class DateExpressionsSuite extends SparkFunSuite with ExpressionEvalHelper {
6060 }
6161 }
6262 checkEvaluation(DayOfYear (Literal .create(null , DateType )), null )
63+ checkEvaluation(DayOfYear (Literal (new Date (sdf.parse(" 1582-10-15 13:10:15" ).getTime))), 288 )
64+ checkEvaluation(DayOfYear (Literal (new Date (sdf.parse(" 1582-10-04 13:10:15" ).getTime))), 277 )
6365 checkConsistencyBetweenInterpretedAndCodegen(DayOfYear , DateType )
6466 }
6567
@@ -80,6 +82,8 @@ class DateExpressionsSuite extends SparkFunSuite with ExpressionEvalHelper {
8082 }
8183 }
8284 }
85+ checkEvaluation(Year (Literal (new Date (sdf.parse(" 1582-01-01 13:10:15" ).getTime))), 1582 )
86+ checkEvaluation(Year (Literal (new Date (sdf.parse(" 1581-12-31 13:10:15" ).getTime))), 1581 )
8387 checkConsistencyBetweenInterpretedAndCodegen(Year , DateType )
8488 }
8589
@@ -100,6 +104,8 @@ class DateExpressionsSuite extends SparkFunSuite with ExpressionEvalHelper {
100104 }
101105 }
102106 }
107+ checkEvaluation(Quarter (Literal (new Date (sdf.parse(" 1582-10-01 13:10:15" ).getTime))), 4 )
108+ checkEvaluation(Quarter (Literal (new Date (sdf.parse(" 1582-09-30 13:10:15" ).getTime))), 3 )
103109 checkConsistencyBetweenInterpretedAndCodegen(Quarter , DateType )
104110 }
105111
@@ -109,6 +115,9 @@ class DateExpressionsSuite extends SparkFunSuite with ExpressionEvalHelper {
109115 checkEvaluation(Month (Cast (Literal (sdfDate.format(d)), DateType )), 4 )
110116 checkEvaluation(Month (Cast (Literal (ts), DateType )), 11 )
111117
118+ checkEvaluation(Month (Literal (new Date (sdf.parse(" 1582-04-28 13:10:15" ).getTime))), 4 )
119+ checkEvaluation(Month (Literal (new Date (sdf.parse(" 1582-10-04 13:10:15" ).getTime))), 10 )
120+ checkEvaluation(Month (Literal (new Date (sdf.parse(" 1582-10-15 13:10:15" ).getTime))), 10 )
112121 (2003 to 2004 ).foreach { y =>
113122 (0 to 3 ).foreach { m =>
114123 (0 to 2 * 24 ).foreach { i =>
@@ -130,6 +139,9 @@ class DateExpressionsSuite extends SparkFunSuite with ExpressionEvalHelper {
130139 checkEvaluation(DayOfMonth (Cast (Literal (sdfDate.format(d)), DateType )), 8 )
131140 checkEvaluation(DayOfMonth (Cast (Literal (ts), DateType )), 8 )
132141
142+ checkEvaluation(DayOfMonth (Literal (new Date (sdf.parse(" 1582-04-28 13:10:15" ).getTime))), 28 )
143+ checkEvaluation(DayOfMonth (Literal (new Date (sdf.parse(" 1582-10-15 13:10:15" ).getTime))), 15 )
144+ checkEvaluation(DayOfMonth (Literal (new Date (sdf.parse(" 1582-10-04 13:10:15" ).getTime))), 4 )
133145 (1999 to 2000 ).foreach { y =>
134146 val c = Calendar .getInstance()
135147 c.set(y, 0 , 1 , 0 , 0 , 0 )
@@ -163,6 +175,8 @@ class DateExpressionsSuite extends SparkFunSuite with ExpressionEvalHelper {
163175 checkEvaluation(WeekOfYear (Cast (Literal (sdfDate.format(d)), DateType )), 15 )
164176 checkEvaluation(WeekOfYear (Cast (Literal (ts), DateType )), 45 )
165177 checkEvaluation(WeekOfYear (Cast (Literal (" 2011-05-06" ), DateType )), 18 )
178+ checkEvaluation(WeekOfYear (Literal (new Date (sdf.parse(" 1582-10-15 13:10:15" ).getTime))), 40 )
179+ checkEvaluation(WeekOfYear (Literal (new Date (sdf.parse(" 1582-10-04 13:10:15" ).getTime))), 40 )
166180 checkConsistencyBetweenInterpretedAndCodegen(WeekOfYear , DateType )
167181 }
168182
0 commit comments