lunar-shadow commented on code in PR #55547:
URL: https://github.com/apache/spark/pull/55547#discussion_r3152971776


##########
sql/core/src/test/scala/org/apache/spark/sql/connector/DataSourceV2SQLSuite.scala:
##########
@@ -2486,6 +2486,36 @@ class DataSourceV2SQLSuiteV1Filter
       ExpectedContext("testcat.ns.tbl", 11, 10 + "testcat.ns.tbl".length))
   }
 
+  test("SPARK-56611: rename table with catalog-qualified identifier") {
+    withTable("testcat.ns.t1", "testcat.ns.t1_renamed") {
+      sql("CREATE TABLE testcat.ns.t1 USING foo AS SELECT id, data FROM 
source")
+      checkAnswer(sql("SHOW TABLES FROM testcat.ns"), Seq(Row("ns", "t1", 
false)))
+
+      // rename with just table name, inherits namespace from source
+      sql("ALTER TABLE testcat.ns.t1 RENAME TO t1_renamed")
+      checkAnswer(sql("SHOW TABLES FROM testcat.ns"), Seq(Row("ns", 
"t1_renamed", false)))
+
+      // rename with namespace-qualified name
+      sql("ALTER TABLE testcat.ns.t1_renamed RENAME TO ns.t1")
+      checkAnswer(sql("SHOW TABLES FROM testcat.ns"), Seq(Row("ns", "t1", 
false)))
+
+      // rename with catalog-qualified target identifier
+      sql("ALTER TABLE testcat.ns.t1 RENAME TO testcat.ns.t1_renamed")
+      checkAnswer(sql("SHOW TABLES FROM testcat.ns"), Seq(Row("ns", 
"t1_renamed", false)))
+    }
+  }
+
+  test("SPARK-56611: rename table across namespace should work for V2 
catalogs") {

Review Comment:
   Done, renamed to "rename table across namespaces"  



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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to