spark-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Apache Spark (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (SPARK-23773) JacksonGenerator does not include keys that have null value for StructTypes
Date Thu, 22 Mar 2018 21:49:00 GMT

    [ https://issues.apache.org/jira/browse/SPARK-23773?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16410361#comment-16410361
] 

Apache Spark commented on SPARK-23773:
--------------------------------------

User 'makagonov' has created a pull request for this issue:
https://github.com/apache/spark/pull/20884

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


Mime
View raw message