Github user chuxi commented on a diff in the pull request:
https://github.com/apache/spark/pull/2082#discussion_r16541208
--- Diff: sql/core/src/test/scala/org/apache/spark/sql/json/JsonSuite.scala
---
@@ -292,24 +292,29 @@ class JsonSuite extends QueryTest {
sql("select structWithArrayFields.field1[1],
structWithArrayFields.field2[3] from jsonTable"),
(5, null) :: Nil
)
- }
- ignore("Complex field and type inferring (Ignored)") {
- val jsonSchemaRDD = jsonRDD(complexFieldAndType)
- jsonSchemaRDD.registerTempTable("jsonTable")
+ checkAnswer(
+ sql("select arrayOfStruct.field1, arrayOfStruct.field2 from
jsonTable"),
+ (Seq(true, false, null), Seq("str1", null, null)) :: Nil
+ )
- // Right now, "field1" and "field2" are treated as aliases. We should
fix it.
checkAnswer(
sql("select arrayOfStruct[0].field1, arrayOfStruct[0].field2 from
jsonTable"),
(true, "str1") :: Nil
)
- // Right now, the analyzer cannot resolve arrayOfStruct.field1 and
arrayOfStruct.field2.
- // Getting all values of a specific field from an array of structs.
+ }
+
+ ignore("Complex field and type inferring (Ignored)") {
+ val jsonSchemaRDD = jsonRDD(complexFieldAndType)
+ jsonSchemaRDD.registerTempTable("jsonTable")
+
+ // still need add filter??? I am not sure whether this function is
necessary. quite complex
checkAnswer(
- sql("select arrayOfStruct.field1, arrayOfStruct.field2 from
jsonTable"),
- (Seq(true, false), Seq("str1", null)) :: Nil
+ sql("select arrayOfStruct.field1 from jsonTable where
arrayOfStruct.field1 = true"),
--- End diff --
I add sql("select arrayOfStruct.field1 from jsonTable where
arrayOfStruct.field1 = true") this test case in ignored part. It does not work
because I came up with it but did not solve it. Or it makes no sense to solve
it.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]