You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2020/10/06 19:36:34 UTC

[GitHub] [spark] MaxGekk commented on a change in pull request #29885: [SPARK-33010][SQL]Make DataFrameWriter.jdbc work for DataSource V2

MaxGekk commented on a change in pull request #29885:
URL: https://github.com/apache/spark/pull/29885#discussion_r500542489



##########
File path: sql/core/src/test/scala/org/apache/spark/sql/jdbc/JDBCV2Suite.scala
##########
@@ -221,4 +221,36 @@ class JDBCV2Suite extends QueryTest with SharedSparkSession {
       checkAnswer(sql("SELECT name, id FROM h2.test.abc"), Row("bob", 4))
     }
   }
+
+  test("DataFrameWriter: jdbc") {

Review comment:
       Other tests above have in their title `DataFrameWriterV2` but this one `DataFrameWriter`. Do you suppose to test v1 mostly here?

##########
File path: sql/core/src/test/scala/org/apache/spark/sql/jdbc/JDBCV2Suite.scala
##########
@@ -221,4 +221,36 @@ class JDBCV2Suite extends QueryTest with SharedSparkSession {
       checkAnswer(sql("SELECT name, id FROM h2.test.abc"), Row("bob", 4))
     }
   }
+
+  test("DataFrameWriter: jdbc") {
+    withTable("h2.test.abc") {
+      sql("CREATE TABLE h2.test.abc USING _ AS SELECT * FROM h2.test.people")
+      val df1 = Seq(("evan", 3)).toDF("NAME", "ID")
+      val df2 = Seq(("cathy", 4)).toDF("NAME", "ID")
+      val properties = new Properties()
+
+      df1.write
+        .mode("append")
+        .jdbc(url, "h2.test.abc", properties)
+      checkAnswer(sql("SELECT name, id FROM h2.test.abc"),
+        Seq(Row("fred", 1), Row("mary", 2), Row("evan", 3)))

Review comment:
       ```suggestion
         checkAnswer(
           sql("SELECT name, id FROM h2.test.abc"),
           Seq(Row("fred", 1), Row("mary", 2), Row("evan", 3)))
   ```




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



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