zhangjun0x01 commented on code in PR #471:
URL: https://github.com/apache/flink-table-store/pull/471#discussion_r1089874987


##########
flink-table-store-hive/flink-table-store-hive-catalog/src/test/java/org/apache/flink/table/store/hive/HiveCatalogITCase.java:
##########
@@ -276,6 +279,36 @@ public void testFlinkWriteAndHiveRead() throws Exception {
         }
     }
 
+    @Test
+    public void testRenameTable() throws Exception {
+        tEnv.executeSql("CREATE TABLE t1 (a INT)").await();
+        tEnv.executeSql("CREATE TABLE t2 (a INT)").await();
+        tEnv.executeSql("INSERT INTO t1 VALUES(1)");
+
+        // the source table do not exist.
+        assertThatThrownBy(() -> tEnv.executeSql("ALTER TABLE t3 RENAME TO 
t4"))
+                .hasMessage(
+                        "Table `my_hive`.`test_db`.`t3` doesn't exist or is a 
temporary table.");
+
+        // the target table has existed.
+        assertThatThrownBy(() -> tEnv.executeSql("ALTER TABLE t1 RENAME TO 
t2"))
+                .hasMessage(
+                        "Could not execute ALTER TABLE my_hive.test_db.t1 
RENAME TO my_hive.test_db.t2");
+
+        tEnv.executeSql("ALTER TABLE t1 RENAME TO t3").await();
+        List<String> tables = hiveShell.executeQuery("SHOW TABLES");
+        Assert.assertTrue(tables.contains("t3"));
+        Assert.assertFalse(tables.contains("t1"));
+

Review Comment:
   > Sounds good
   
   sorry for the late update, could you help review it again? thanks



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

Reply via email to