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

    https://github.com/apache/spark/pull/3110#discussion_r20049405
  
    --- Diff: 
sql/hive/src/test/scala/org/apache/spark/sql/hive/InsertIntoHiveTableSuite.scala
 ---
    @@ -121,4 +121,54 @@ class InsertIntoHiveTableSuite extends QueryTest {
         sql("DROP TABLE table_with_partition")
         sql("DROP TABLE tmp_table")
       }
    +
    +  test("Insert ArrayType.containsNull == false") {
    +    val schema = StructType(Seq(
    +      StructField("a", ArrayType(StringType, containsNull = false))))
    +    val rowRDD = TestHive.sparkContext.parallelize((1 to 100).map(i => 
Row(Seq(s"value$i"))))
    +    val schemaRDD = applySchema(rowRDD, schema)
    +    schemaRDD.registerTempTable("tableWithArrayValue")
    +    sql("CREATE TABLE hiveTableWithArrayValue(a Array <STRING>)")
    +    sql("INSERT OVERWRITE TABLE hiveTableWithArrayValue SELECT a FROM 
tableWithArrayValue")
    +
    +    checkAnswer(
    +      sql("SELECT * FROM hiveTableWithArrayValue"),
    +      rowRDD.collect().toSeq)
    +
    +    sql("DROP TABLE hiveTableWithArrayValue")
    +  }
    +
    +  test("Insert MapType.valueContainsNull == false") {
    +    val schema = StructType(Seq(
    +      StructField("m", MapType(StringType, StringType, valueContainsNull = 
false))))
    +    val rowRDD = TestHive.sparkContext.parallelize(
    +      (1 to 100).map(i => Row(Map(s"key$i" -> s"value$i"))))
    +    val schemaRDD = applySchema(rowRDD, schema)
    +    schemaRDD.registerTempTable("tableWithMapValue")
    +    sql("CREATE TABLE hiveTableWithMapValue(m Map <STRING, STRING>)")
    +    sql("INSERT OVERWRITE TABLE hiveTableWithMapValue SELECT m FROM 
tableWithMapValue")
    +
    +    checkAnswer(
    +      sql("SELECT * FROM hiveTableWithMapValue"),
    +      rowRDD.collect().toSeq)
    +
    +    sql("DROP TABLE hiveTableWithMapValue")
    +  }
    +
    +  test("Insert StringType.fields.exists(_.nullable == false)") {
    --- End diff --
    
    `StructType.fields.exists`?


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

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

Reply via email to