You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Davies Liu (JIRA)" <ji...@apache.org> on 2014/11/18 21:21:33 UTC

[jira] [Updated] (SPARK-4476) Use MapType for dict in json which has unique keys in each row.

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

Davies Liu updated SPARK-4476:
------------------------------
    Description: 
For the jsonRDD like this: 
{code}
""" {a: 1} """
""" {b: 2} """
""" {c: 3} """
""" {d: 4} """
""" {e: 5} """
{code}

It will create a StructType with 5 fileds in it, each field come from a different row. It will be a problem if the RDD is large. A StructType with thousands or millions fields is hard to play with (will cause stack overflow during serialization).

It should be MapType for this case. We need a clear rule to decide StructType or MapType will be used for dict in json data. 

cc [~yhuai] [~marmbrus]


  was:
For the jsonRDD like this: 
{code}
""" {a: 1} """
""" {b: 2} """
""" {c: 3} """
""" {d: 4} """
""" {e: 5} """
{code}

It will create a StructType with 5 fileds in it, each field come from a different row. It will be a problem if the RDD is large. A StructType with thousands or millions fields is hard to play with (will cause stack overflow during serialization).

It should be MapType for this case. We need a clear rule to decide StructType or MapType will be used for dict in json data. 




> Use MapType for dict in json which has unique keys in each row.
> ---------------------------------------------------------------
>
>                 Key: SPARK-4476
>                 URL: https://issues.apache.org/jira/browse/SPARK-4476
>             Project: Spark
>          Issue Type: New Feature
>          Components: SQL
>            Reporter: Davies Liu
>            Priority: Critical
>
> For the jsonRDD like this: 
> {code}
> """ {a: 1} """
> """ {b: 2} """
> """ {c: 3} """
> """ {d: 4} """
> """ {e: 5} """
> {code}
> It will create a StructType with 5 fileds in it, each field come from a different row. It will be a problem if the RDD is large. A StructType with thousands or millions fields is hard to play with (will cause stack overflow during serialization).
> It should be MapType for this case. We need a clear rule to decide StructType or MapType will be used for dict in json data. 
> cc [~yhuai] [~marmbrus]



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

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