Github user dongjoon-hyun commented on a diff in the pull request:

    https://github.com/apache/spark/pull/20527#discussion_r166770787
  
    --- Diff: 
sql/core/src/test/scala/org/apache/spark/sql/execution/command/DDLSuite.scala 
---
    @@ -132,6 +134,32 @@ class InMemoryCatalogedDDLSuite extends DDLSuite with 
SharedSQLContext with Befo
           checkAnswer(spark.table("t"), Row(Row("a", 1)) :: Nil)
         }
       }
    +
    +  // TODO: This test is copied from HiveDDLSuite, unify it later.
    +  test("SPARK-23348: append data to data source table with saveAsTable") {
    +    withTable("t", "t1") {
    +      Seq(1 -> "a").toDF("i", "j").write.saveAsTable("t")
    +      checkAnswer(spark.table("t"), Row(1, "a"))
    +
    +      sql("INSERT INTO t SELECT 2, 'b'")
    +      checkAnswer(spark.table("t"), Row(1, "a") :: Row(2, "b") :: Nil)
    +
    +      Seq(3 -> "c").toDF("i", "j").write.mode("append").saveAsTable("t")
    +      checkAnswer(spark.table("t"), Row(1, "a") :: Row(2, "b") :: Row(3, 
"c") :: Nil)
    +
    +      Seq("c" -> 3).toDF("i", "j").write.mode("append").saveAsTable("t")
    +      checkAnswer(spark.table("t"), Row(1, "a") :: Row(2, "b") :: Row(3, 
"c")
    +        :: Row(null, "3") :: Nil)
    --- End diff --
    
    Thank you for pining me, @cloud-fan . +1 for the patch, LGTM.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to