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

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.6.3, 2.0.2, 2.1.3, 2.2.3, 2.3.3, 2.4.3
    • Fix Version/s: 2.4.4, 3.0.0
    • Component/s: SQL
    • Labels:

      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

              • Assignee:
                maxgekk Maxim Gekk
                Reporter:
                yumwang Yuming Wang
              • Votes:
                0 Vote for this issue
                Watchers:
                6 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: