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

JSON/CSV formats timestamps incorrectly

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 2.4.4
    • 2.4.5
    • SQL
    • None

    Description

      For example:

      scala> val t = java.sql.Timestamp.valueOf("2019-11-18 11:56:00.123456")
      t: java.sql.Timestamp = 2019-11-18 11:56:00.123456
      scala> Seq(t).toDF("t").select(to_json(struct($"t"), Map("timestampFormat" -> "yyyy-MM-dd HH:mm:ss.SSSSSS"))).show(false)
      +-------------------------------------------------+
      |structstojson(named_struct(NamePlaceholder(), t))|
      +-------------------------------------------------+
      |{"t":"2019-11-18 11:56:00.000123"}               |
      +-------------------------------------------------+
      

      Attachments

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved: