guiyanakuang commented on a change in pull request #30467:
URL: https://github.com/apache/spark/pull/30467#discussion_r528529013
##########
File path: sql/core/src/test/scala/org/apache/spark/sql/ComplexTypesSuite.scala
##########
@@ -117,4 +116,13 @@ class ComplexTypesSuite extends QueryTest with
SharedSparkSession {
val df = spark.createDataFrame(List(Row(Seq(Row(1), Row(null)))).asJava,
schema)
checkAnswer(df.select($"arr".getField("i")), Row(Seq(1, null)))
}
+
+ test("SPARK-32002: Support ExtractValue from nested ArrayStruct") {
+ val jsonStr1 = """{"a": [{"b": [{"c": [1,2]}]}]}"""
+ val jsonStr2 = """{"a": [{"b": [{"c": [1]}, {"c": [2]}]}]}"""
+ val df = spark.read.json(Seq(jsonStr1, jsonStr2).toDS())
+ checkAnswer(df.select($"a.b.c"), Row(Seq(Seq(Seq(1, 2))))
+ :: Row(Seq(Seq(Seq(1), Seq(2)))) :: Nil)
+ }
+
Review comment:
OK, I add a test for which the depth can be adjusted.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]