Github user liancheng commented on a diff in the pull request:

    https://github.com/apache/spark/pull/10331#discussion_r48218880
  
    --- Diff: sql/core/src/test/scala/org/apache/spark/sql/DatasetSuite.scala 
---
    @@ -515,12 +516,44 @@ class DatasetSuite extends QueryTest with 
SharedSQLContext {
         }
         assert(e.getMessage.contains("cannot resolve 'c' given input columns 
a, b"), e.getMessage)
       }
    +
    +  test("runtime nullability check") {
    +    val schema = StructType(Seq(
    +      StructField("f", StructType(Seq(
    +        StructField("a", StringType, nullable = true),
    +        StructField("b", IntegerType, nullable = false)
    +      )), nullable = true)
    +    ))
    +
    +    def buildDataset(rows: Row*): Dataset[NestedStruct] = {
    +      val rowRDD = sqlContext.sparkContext.parallelize(rows)
    +      sqlContext.createDataFrame(rowRDD, schema).as[NestedStruct]
    +    }
    +
    +    checkAnswer(
    +      buildDataset(Row(Row("hello", 1))),
    +      NestedStruct(ClassData("hello", 1))
    +    )
    +
    +    // Shouldn't throw runtime exception when parent object (`ClassData`) 
is null
    --- End diff --
    
    Good catch! Verified that the current mechanism doesn't play well with 
primitive arrays.


---
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]

Reply via email to