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

Check stringToDate() consumes entire input for the yyyy and yyyy-[m]m formats

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 1.6.3, 2.0.2, 2.1.3, 2.2.3, 2.3.3, 2.4.3
    • 2.4.4, 3.0.0
    • SQL

    Description

      Invalid date formats should throw an exception:

      SELECT date '1999 08 01'
      1999-01-01
      

      Supported date formats:
      https://github.com/apache/spark/blob/ab8710b57916a129fcb89464209361120d224535/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/util/DateTimeUtils.scala#L365-L374

      Since Spark 1.6.3 ~ 2.4.3, the behavior is the same.

      spark-sql> SELECT CAST('1999 08 01' AS DATE);
      1999-01-01
      

      Hive returns NULL.

      Attachments

        Issue Links

          Activity

            People

              maxgekk Max Gekk
              yumwang Yuming Wang
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: