File tree Expand file tree Collapse file tree 1 file changed +10
-12
lines changed
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/csv Expand file tree Collapse file tree 1 file changed +10
-12
lines changed Original file line number Diff line number Diff 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 }
You can’t perform that action at this time.
0 commit comments