XMLWordPrintableJSON

Details

    • Sub-task
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 3.0.0, 3.1.0
    • 3.0.0
    • SQL
    • None

    Description

      Spark 2.4.5:

      scala> val ds = Seq("{'d': '-141704'}").toDS
      ds: org.apache.spark.sql.Dataset[String] = [value: string]
      
      scala> val json = spark.read.schema("d date").json(ds)
      json: org.apache.spark.sql.DataFrame = [d: date]
      
      scala> json.show
      +----------+
      |         d|
      +----------+
      |1582-01-01|
      +----------+
      

      Spark 3.1.0-SNAPSHOT:

      scala> val ds = Seq("{'d': '-141704'}").toDS
      ds: org.apache.spark.sql.Dataset[String] = [value: string]
      
      scala> val json = spark.read.schema("d date").json(ds)
      json: org.apache.spark.sql.DataFrame = [d: date]
      
      scala> json.show
      +----------+
      |         d|
      +----------+
      |1582-01-11|
      +----------+
      

      Attachments

        Activity

          People

            maxgekk Max Gekk
            maxgekk Max Gekk
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: