[ 
https://issues.apache.org/jira/browse/SPARK-23773?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Sergey updated SPARK-23773:
---------------------------
    Issue Type: Bug  (was: Improvement)

> JacksonGenerator does not include keys that have null value for StructTypes
> ---------------------------------------------------------------------------
>
>                 Key: SPARK-23773
>                 URL: https://issues.apache.org/jira/browse/SPARK-23773
>             Project: Spark
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 2.0.0, 2.3.0
>            Reporter: Sergey
>            Priority: Trivial
>
> When "toJSON" is called on a dataset, the result JSON string will not have 
> keys displayed for StructTypes that have null value.
> Repro:
> {noformat}
> scala> val sqlContext = new org.apache.spark.sql.SQLContext(sc)
> ...
> scala> val df = sqlContext.sql(""" select NAMED_STRUCT('f1', null, 'f2', 
> ARRAY(TRUE, FALSE), 'f3', MAP(123L, 123.456), 'f4', 'some string') as 
> my_struct  """)
>  ...
> scala> df.toJSON.collect().foreach(println)
> {"my_struct":{"f2":[true,false],"f3":({"123":123.456},"f4":"some string"}}
> {noformat}
> The key "f1" is missing in JSON string.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

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

Reply via email to