You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Apache Spark (JIRA)" <ji...@apache.org> on 2017/02/14 16:42:42 UTC

[jira] [Assigned] (SPARK-19595) from_json produces only a single row when input is a json array

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

Apache Spark reassigned SPARK-19595:
------------------------------------

    Assignee:     (was: Apache Spark)

> from_json produces only a single row when input is a json array
> ---------------------------------------------------------------
>
>                 Key: SPARK-19595
>                 URL: https://issues.apache.org/jira/browse/SPARK-19595
>             Project: Spark
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 2.2.0
>            Reporter: Hyukjin Kwon
>            Priority: Minor
>
> Currently, {{from_json}} reads a single row when it is a json array. For example,
> {code}
> import org.apache.spark.sql.functions._
> import org.apache.spark.sql.types._
> val schema = StructType(StructField("a", IntegerType) :: Nil)
> Seq(("""[{"a": 1}, {"a": 2}]""")).toDF("struct").select(from_json(col("struct"), schema)).show()
> +--------------------+
> |jsontostruct(struct)|
> +--------------------+
> |                 [1]|
> +--------------------+
> {code}
> Maybe we should not support this in that function or it should work like a generator expression.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

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