@@ -60,6 +60,8 @@ class DateExpressionsSuite extends SparkFunSuite with ExpressionEvalHelper {
60
60
}
61
61
}
62
62
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 )
63
65
checkConsistencyBetweenInterpretedAndCodegen(DayOfYear , DateType )
64
66
}
65
67
@@ -80,6 +82,8 @@ class DateExpressionsSuite extends SparkFunSuite with ExpressionEvalHelper {
80
82
}
81
83
}
82
84
}
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 )
83
87
checkConsistencyBetweenInterpretedAndCodegen(Year , DateType )
84
88
}
85
89
@@ -100,6 +104,8 @@ class DateExpressionsSuite extends SparkFunSuite with ExpressionEvalHelper {
100
104
}
101
105
}
102
106
}
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 )
103
109
checkConsistencyBetweenInterpretedAndCodegen(Quarter , DateType )
104
110
}
105
111
@@ -109,6 +115,9 @@ class DateExpressionsSuite extends SparkFunSuite with ExpressionEvalHelper {
109
115
checkEvaluation(Month (Cast (Literal (sdfDate.format(d)), DateType )), 4 )
110
116
checkEvaluation(Month (Cast (Literal (ts), DateType )), 11 )
111
117
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 )
112
121
(2003 to 2004 ).foreach { y =>
113
122
(0 to 3 ).foreach { m =>
114
123
(0 to 2 * 24 ).foreach { i =>
@@ -130,6 +139,9 @@ class DateExpressionsSuite extends SparkFunSuite with ExpressionEvalHelper {
130
139
checkEvaluation(DayOfMonth (Cast (Literal (sdfDate.format(d)), DateType )), 8 )
131
140
checkEvaluation(DayOfMonth (Cast (Literal (ts), DateType )), 8 )
132
141
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 )
133
145
(1999 to 2000 ).foreach { y =>
134
146
val c = Calendar .getInstance()
135
147
c.set(y, 0 , 1 , 0 , 0 , 0 )
@@ -163,6 +175,8 @@ class DateExpressionsSuite extends SparkFunSuite with ExpressionEvalHelper {
163
175
checkEvaluation(WeekOfYear (Cast (Literal (sdfDate.format(d)), DateType )), 15 )
164
176
checkEvaluation(WeekOfYear (Cast (Literal (ts), DateType )), 45 )
165
177
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 )
166
180
checkConsistencyBetweenInterpretedAndCodegen(WeekOfYear , DateType )
167
181
}
168
182
0 commit comments