dongjoon-hyun commented on a change in pull request #28992:
URL: https://github.com/apache/spark/pull/28992#discussion_r449790991



##########
File path: sql/core/src/test/scala/org/apache/spark/sql/ComplexTypesSuite.scala
##########
@@ -106,4 +110,11 @@ class ComplexTypesSuite extends QueryTest with 
SharedSparkSession {
     checkAnswer(df1, Row(10, 12) :: Row(11, 13) :: Nil)
     checkNamedStruct(df.queryExecution.optimizedPlan, expectedCount = 0)
   }
+
+  test("SPARK-32167: get field from an array of struct") {
+    val innerStruct = new StructType().add("i", "int", nullable = true)
+    val schema = new StructType().add("arr", ArrayType(innerStruct, 
containsNull = false))
+    val df = spark.createDataFrame(List(Row(Seq(Row(1), Row(null)))).asJava, 
schema)
+    checkAnswer(df.select($"arr".getField("i")), Row(Seq(1, null)))

Review comment:
       @cloud-fan . This doesn't check the nullability. Does this fail without 
your patch? 




----------------------------------------------------------------
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:
us...@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to