spark-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [spark] cloud-fan commented on a change in pull request #29324: [SPARK-32402][SQL] Implement ALTER TABLE in JDBC Table Catalog
Date Tue, 04 Aug 2020 03:59:38 GMT

cloud-fan commented on a change in pull request #29324:
URL: https://github.com/apache/spark/pull/29324#discussion_r464784760



##########
File path: sql/core/src/test/scala/org/apache/spark/sql/execution/datasources/v2/jdbc/JDBCTableCatalogSuite.scala
##########
@@ -106,4 +106,75 @@ class JDBCTableCatalogSuite extends QueryTest with SharedSparkSession
{
         Seq(Row("test", "people"), Row("test", "new_table")))
     }
   }
+
+  test("alter table ... add column") {
+    withTable("h2.test.alt_table") {
+      sql("CREATE TABLE h2.test.alt_table (ID INTEGER) USING _")
+      sql("ALTER TABLE h2.test.alt_table ADD COLUMNS (C1 INTEGER, C2 STRING)")
+      var t = spark.table("h2.test.alt_table")
+      var expectedSchema = new StructType()
+        .add("ID", IntegerType)
+        .add("C1", IntegerType)
+        .add("C2", StringType)
+      assert(t.schema === expectedSchema)
+      sql("ALTER TABLE h2.test.alt_table ADD COLUMNS (C3 DOUBLE)")
+      t = spark.table("h2.test.alt_table")
+      expectedSchema = new StructType()

Review comment:
       nit: `expectedSchema = expectedSchema.add("C3", DoubleType)`




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


Mime
View raw message