MaxGekk commented on a change in pull request #27710:
URL: https://github.com/apache/spark/pull/27710#discussion_r418754052
##########
File path:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/json/JacksonParser.scala
##########
@@ -239,7 +246,23 @@ class JacksonParser(
case DateType =>
(parser: JsonParser) => parseJsonToken[java.lang.Integer](parser,
dataType) {
case VALUE_STRING if parser.getTextLength >= 1 =>
- dateFormatter.parse(parser.getText)
+ try {
+ dateFormatter.parse(parser.getText)
+ } catch {
+ case NonFatal(e) =>
+ // If fails to parse, then tries the way used in 2.0 and 1.x for
backwards
+ // compatibility.
+ val str =
UTF8String.fromString(DateTimeUtils.cleanLegacyTimestampStr(parser.getText))
+ DateTimeUtils.stringToDate(str, options.zoneId).getOrElse {
+ // In Spark 1.5.0, we store the data as number of days since
epoch in string.
+ // So, we just convert it to Int.
+ try {
+ parser.getText.toInt
Review comment:
Should we rebase this?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]