@@ -76,6 +76,9 @@ class DateExpressionsSuite extends SparkFunSuite with ExpressionEvalHelper {
76
76
}
77
77
}
78
78
checkEvaluation(DayOfYear (Literal .create(null , DateType )), null )
79
+
80
+ checkEvaluation(DayOfYear (Literal (new Date (sdf.parse(" 1582-10-15 13:10:15" ).getTime))), 288 )
81
+ checkEvaluation(DayOfYear (Literal (new Date (sdf.parse(" 1582-10-04 13:10:15" ).getTime))), 277 )
79
82
checkConsistencyBetweenInterpretedAndCodegen(DayOfYear , DateType )
80
83
}
81
84
@@ -96,6 +99,8 @@ class DateExpressionsSuite extends SparkFunSuite with ExpressionEvalHelper {
96
99
}
97
100
}
98
101
}
102
+ checkEvaluation(Year (Literal (new Date (sdf.parse(" 1582-01-01 13:10:15" ).getTime))), 1582 )
103
+ checkEvaluation(Year (Literal (new Date (sdf.parse(" 1581-12-31 13:10:15" ).getTime))), 1581 )
99
104
checkConsistencyBetweenInterpretedAndCodegen(Year , DateType )
100
105
}
101
106
@@ -116,6 +121,9 @@ class DateExpressionsSuite extends SparkFunSuite with ExpressionEvalHelper {
116
121
}
117
122
}
118
123
}
124
+
125
+ checkEvaluation(Quarter (Literal (new Date (sdf.parse(" 1582-10-01 13:10:15" ).getTime))), 4 )
126
+ checkEvaluation(Quarter (Literal (new Date (sdf.parse(" 1582-09-30 13:10:15" ).getTime))), 3 )
119
127
checkConsistencyBetweenInterpretedAndCodegen(Quarter , DateType )
120
128
}
121
129
@@ -125,6 +133,10 @@ class DateExpressionsSuite extends SparkFunSuite with ExpressionEvalHelper {
125
133
checkEvaluation(Month (Cast (Literal (sdfDate.format(d)), DateType , gmtId)), 4 )
126
134
checkEvaluation(Month (Cast (Literal (ts), DateType , gmtId)), 11 )
127
135
136
+ checkEvaluation(Month (Literal (new Date (sdf.parse(" 1582-04-28 13:10:15" ).getTime))), 4 )
137
+ checkEvaluation(Month (Literal (new Date (sdf.parse(" 1582-10-04 13:10:15" ).getTime))), 10 )
138
+ checkEvaluation(Month (Literal (new Date (sdf.parse(" 1582-10-15 13:10:15" ).getTime))), 10 )
139
+
128
140
val c = Calendar .getInstance()
129
141
(2003 to 2004 ).foreach { y =>
130
142
(0 to 3 ).foreach { m =>
@@ -146,6 +158,10 @@ class DateExpressionsSuite extends SparkFunSuite with ExpressionEvalHelper {
146
158
checkEvaluation(DayOfMonth (Cast (Literal (sdfDate.format(d)), DateType , gmtId)), 8 )
147
159
checkEvaluation(DayOfMonth (Cast (Literal (ts), DateType , gmtId)), 8 )
148
160
161
+ checkEvaluation(DayOfMonth (Literal (new Date (sdf.parse(" 1582-04-28 13:10:15" ).getTime))), 28 )
162
+ checkEvaluation(DayOfMonth (Literal (new Date (sdf.parse(" 1582-10-15 13:10:15" ).getTime))), 15 )
163
+ checkEvaluation(DayOfMonth (Literal (new Date (sdf.parse(" 1582-10-04 13:10:15" ).getTime))), 4 )
164
+
149
165
val c = Calendar .getInstance()
150
166
(1999 to 2000 ).foreach { y =>
151
167
c.set(y, 0 , 1 , 0 , 0 , 0 )
@@ -186,6 +202,8 @@ class DateExpressionsSuite extends SparkFunSuite with ExpressionEvalHelper {
186
202
checkEvaluation(WeekOfYear (Cast (Literal (sdfDate.format(d)), DateType , gmtId)), 15 )
187
203
checkEvaluation(WeekOfYear (Cast (Literal (ts), DateType , gmtId)), 45 )
188
204
checkEvaluation(WeekOfYear (Cast (Literal (" 2011-05-06" ), DateType , gmtId)), 18 )
205
+ checkEvaluation(WeekOfYear (Literal (new Date (sdf.parse(" 1582-10-15 13:10:15" ).getTime))), 40 )
206
+ checkEvaluation(WeekOfYear (Literal (new Date (sdf.parse(" 1582-10-04 13:10:15" ).getTime))), 40 )
189
207
checkConsistencyBetweenInterpretedAndCodegen(WeekOfYear , DateType )
190
208
}
191
209
0 commit comments