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

String to date and timestamp conversion should return null on some invalid date string

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 1.6.1, 2.0.0
    • 2.0.0
    • SQL
    • None

    Description

      spark.sql("select cast('2016-02-30 00:00:00' as date)") returns 2016-03-01, but spark.sql("select cast('2016-02-32 00:00:00' as date)") returns null. (See this notebook: https://databricks-prod-cloudfront.cloud.databricks.com/public/4027ec902e239c93eaaa8714f173bcfc/7973071962862063/3036006015533946/58107563000366/latest.html)
      I suppose all invalid dates should be returned as null.
      '2016-04-31', '2016-06-31', etc. also have the same issue.

      Attachments

        Issue Links

          Activity

            People

              Yang Wang Yang Wang
              Yang Wang Yang Wang
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: