Skip to content

Commit 10ca4a4

Browse files
committed
update the priority order for SPARK-39469
1 parent 2962cd9 commit 10ca4a4

File tree

1 file changed

+10
-12
lines changed

1 file changed

+10
-12
lines changed

sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/csv/UnivocityParser.scala

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -234,19 +234,17 @@ class UnivocityParser(
234234
timestampFormatter.parse(datum)
235235
} catch {
236236
case NonFatal(e) =>
237-
// If fails to parse, then tries the way used in 2.0 and 1.x for backwards
238-
// compatibility if enabled.
239-
if (!enableParsingFallbackForDateType) {
240-
throw e
241-
}
242-
val str = DateTimeUtils.cleanLegacyTimestampStr(UTF8String.fromString(datum))
243-
DateTimeUtils.stringToTimestamp(str, options.zoneId).getOrElse {
244-
// There may be date type entries in timestamp column due to schema inference
245-
if (options.inferDate) {
246-
daysToMicros(dateFormatter.parse(datum), options.zoneId)
247-
} else {
248-
throw(e)
237+
// There may be date type entries in timestamp column due to schema inference
238+
if (options.inferDate) {
239+
daysToMicros(dateFormatter.parse(datum), options.zoneId)
240+
} else {
241+
// If fails to parse, then tries the way used in 2.0 and 1.x for backwards
242+
// compatibility if enabled.
243+
if (!enableParsingFallbackForDateType) {
244+
throw e
249245
}
246+
val str = DateTimeUtils.cleanLegacyTimestampStr(UTF8String.fromString(datum))
247+
DateTimeUtils.stringToTimestamp(str, options.zoneId).getOrElse(throw(e))
250248
}
251249
}
252250
}

0 commit comments

Comments
 (0)