File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/util Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -154,8 +154,14 @@ class LegacyFallbackDateFormatter(
154
154
timeZone : TimeZone ,
155
155
locale : Locale ) extends LegacyDateFormatter (pattern, timeZone, locale) {
156
156
override def parse (s : String ): Int = {
157
- Try (super .parse(s)).getOrElse {
158
- DateTimeUtils .millisToDays(DateTimeUtils .stringToTime(s).getTime)
157
+ Try (super .parse(s)).orElse {
158
+ // If it fails to parse, then tries the way used in 2.0 and 1.x for backwards
159
+ // compatibility.
160
+ Try (DateTimeUtils .millisToDays(DateTimeUtils .stringToTime(s).getTime))
161
+ }.getOrElse {
162
+ // In Spark 1.5.0, we store the data as number of days since epoch in string.
163
+ // So, we just convert it to Int.
164
+ s.toInt
159
165
}
160
166
}
161
167
}
You can’t perform that action at this time.
0 commit comments