[ https://issues.apache.org/jira/browse/SPARK-14034?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15247988#comment-15247988 ]
Barry Jones edited comment on SPARK-14034 at 4/19/16 3:42 PM: -------------------------------------------------------------- I have the same issue. Nested data values are associated with the wrong keys in the case class. From what I can tell the incorrect association seems consistent (I haven't noticed it shuffling arbitrarily upon reloads). I have tried creating a new file promoting the nested data to top-level data, and have confirmed it is correctly loaded when it isn't nested. So there appears to be a bug loading JSON containing arrays of nested data as a Dataset. was (Author: barryjones): I have the same issue. Nested data values are associated with the wrong keys in the case class. From what I can tell the incorrect association seems consistent (I haven't noticed it shuffling arbitrarily upon reloads). I have tried creating a new file promoting the nested data to top-level data, and have confirmed it is correctly loaded when it isn't nested. So there appears to be a bug loading nested JSON as a Dataset. > Converting to Dataset causes wrong order and values in nested array of > documents > -------------------------------------------------------------------------------- > > Key: SPARK-14034 > URL: https://issues.apache.org/jira/browse/SPARK-14034 > Project: Spark > Issue Type: Bug > Components: SQL > Affects Versions: 1.6.1 > Reporter: Steven She > > I'm deserializing the following JSON document into a Dataset with Spark 1.6.1 > in the console: > {noformat} > {"arr": [{"c": 1, "b": 2, "a": 3}]} > {noformat} > I have the following case classes: > {noformat} > case class X(arr: Seq[Y]) > case class Y(c: Int, b: Int, a: Int) > {noformat} > I run the following in the console to retrieve the value of `c` in the array, > which should have a value of 1 in the data file, but I get the value 3 > instead: > {noformat} > scala> sqlContext.read.json("../test.json").as[X].collect().head.arr.head.c > res19: Int = 3 > {noformat} -- This message was sent by Atlassian JIRA (v6.3.4#6332) --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org For additional commands, e-mail: issues-h...@spark.apache.org