German Schiavon Matteo created SPARK-32158:
----------------------------------------------

             Summary: Add JSONOptions to toJSON
                 Key: SPARK-32158
                 URL: https://issues.apache.org/jira/browse/SPARK-32158
             Project: Spark
          Issue Type: Improvement
          Components: SQL
    Affects Versions: 3.0.0
            Reporter: German Schiavon Matteo
             Fix For: 3.0.1, 3.1.0


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.

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

After the PR:
{code:java}
val result = df.toJSON(Map("ignoreNullFields" -> 
"false")).collect().mkString(",")
val expected = """{"col1":"1"},{"col1":"2"},{"col1":null}"""
{code}
[~maropu] 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org
For additional commands, e-mail: issues-h...@spark.apache.org

Reply via email to