Uploaded image for project: 'Spark'
  1. Spark
  2. SPARK-46396

LegacyFastTimestampFormatter.parseOptional should not throw exception

    XMLWordPrintableJSON

Details

    Description

      When setting spark.sql.legacy.timeParserPolicy=LEGACY, Spark will use the LegacyFastTimestampFormatter to infer potential timestamp columns. The inference shouldn't throw exception.

      However, when the input is 23012150952, there is exception:

      ```

      For input string: "23012150952"

      java.lang.NumberFormatException: For input string: "23012150952"

      at java.base/java.lang.NumberFormatException.forInputString(NumberFormatException.java:67)

      at java.base/java.lang.Integer.parseInt(Integer.java:668)

      at java.base/java.lang.Integer.parseInt(Integer.java:786)

      at org.apache.commons.lang3.time.FastDateParser$NumberStrategy.parse(FastDateParser.java:304)

      at org.apache.commons.lang3.time.FastDateParser.parse(FastDateParser.java:1045)

      at org.apache.commons.lang3.time.FastDateFormat.parse(FastDateFormat.java:651)

      at org.apache.spark.sql.catalyst.util.LegacyFastTimestampFormatter.parseOptional(TimestampFormatter.scala:418)

      ```

      Attachments

        Issue Links

          Activity

            People

              Gengliang.Wang Gengliang Wang
              Gengliang.Wang Gengliang Wang
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: