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

JSON/CSV formats timestamps incorrectly

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.4.4
    • Fix Version/s: 2.4.5
    • Component/s: SQL
    • Labels:
      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

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

                Dates

                • Created:
                  Updated:
                  Resolved: