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

Add JSONOptions to toJSON

Rank to TopRank to BottomAttach filesAttach ScreenshotBulk Copy AttachmentsBulk Move AttachmentsVotersWatch issueWatchersCreate sub-taskConvert to sub-taskLinkCloneLabelsUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Minor
    • Resolution: Won't Fix
    • 3.0.0
    • None
    • SQL
    • None

    Description

      Actually when calling `toJSON` on a dataFrame with null values, it doesn't print them.

      Basically the same idea than https://issues.apache.org/jira/browse/SPARK-23772.

       

      val df = spark.sparkContext.parallelize(Seq("1", "2", null)).toDF("col1")
      df.toJSON -> {"col1":"1"},{"col1":"2"},{}

       

      After the PR:

      val result = df.toJSON(Map("ignoreNullFields" -> "false")).collect().mkString(",")
      val expected = """{"col1":"1"},{"col1":"2"},{"col1":null}"""
      

      Takeshi Yamamuro Takuya Ueshin

       

      https://github.com/apache/spark/pull/28984/

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            Unassigned Unassigned
            gschiavon German Schiavon Matteo
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment