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

LegacyFastTimestampFormatter.parseOptional should not throw exception

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    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

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          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:

              Slack

                Issue deployment