cloud-fan commented on a change in pull request #29324:
URL: https://github.com/apache/spark/pull/29324#discussion_r464257254
##########
File path:
sql/core/src/test/scala/org/apache/spark/sql/execution/datasources/v2/jdbc/JDBCTableCatalogSuite.scala
##########
@@ -106,4 +108,60 @@ 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 _")
+ assert(checkColumnExistence("h2.test.alt_table", Array("ID")))
+ sql("ALTER TABLE h2.test.alt_table ADD COLUMNS (C1 INTEGER, C2 STRING)")
+ assert(checkColumnExistence("h2.test.alt_table", Array("ID", "C1",
"C2")))
+ sql("ALTER TABLE h2.test.alt_table ADD COLUMNS (C3 DOUBLE)")
+ assert(checkColumnExistence("h2.test.alt_table", Array("ID", "C1", "C2",
"C3")))
+ }
+ }
+
+ test("alter table ... rename column") {
+ withTable("h2.test.alt_table") {
+ sql("CREATE TABLE h2.test.alt_table (ID INTEGER) USING _")
+ assert(checkColumnExistence("h2.test.alt_table", Array("ID")))
+ sql("ALTER TABLE h2.test.alt_table RENAME COLUMN ID TO C")
+ assert(checkColumnExistence("h2.test.alt_table", Array("C")))
+ }
+ }
+
+ test("alter table ... drop column") {
+ withTable("h2.test.alt_table") {
+ sql("CREATE TABLE h2.test.alt_table (C1 INTEGER, C2 INTEGER) USING _")
+ assert(checkColumnExistence("h2.test.alt_table", Array("C1", "C2")))
+ sql("ALTER TABLE h2.test.alt_table DROP COLUMN C1")
+ assert(checkColumnExistence("h2.test.alt_table", Array("C2")))
+ }
+ }
+
+ test("alter table ... update column type") {
Review comment:
let's add a new test to test "update column nullability"
----------------------------------------------------------------
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:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]