[ https://issues.apache.org/jira/browse/SPARK-19595?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Burak Yavuz resolved SPARK-19595. --------------------------------- Resolution: Fixed Fix Version/s: 2.2.0 Resolved by https://github.com/apache/spark/pull/16929 > 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 > Assignee: Hyukjin Kwon > Priority: Minor > Fix For: 2.2.0 > > > 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-unsubscr...@spark.apache.org For additional commands, e-mail: issues-h...@spark.apache.org