You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Sergey (JIRA)" <ji...@apache.org> on 2019/04/23 01:07:00 UTC

[jira] [Updated] (SPARK-23773) JacksonGenerator does not include keys that have null value for StructTypes

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

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

> 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: Improvement
>          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-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org