shenzhu commented on a change in pull request #17831:
URL: https://github.com/apache/flink/pull/17831#discussion_r757216616



##########
File path: 
flink-connectors/flink-connector-hive/src/main/java/org/apache/flink/table/catalog/hive/HiveCatalog.java
##########
@@ -398,6 +398,34 @@ public void alterDatabase(
         }
     }
 
+    @Override
+    public void renameDatabase(
+            String databaseName, String newDatabaseName, boolean 
ignoreIfNotExists)
+            throws DatabaseNotExistException, DatabaseAlreadyExistException, 
CatalogException {
+        checkArgument(
+                !isNullOrWhitespaceOnly(databaseName), "databaseName cannot be 
null or empty");
+        checkArgument(
+                !isNullOrWhitespaceOnly(newDatabaseName),
+                "newDatabaseName cannot be null or empty");
+
+        try {
+            if (databaseExists(databaseName)) {
+                if (databaseExists(newDatabaseName)) {
+                    throw new DatabaseAlreadyExistException(getName(), 
newDatabaseName);
+                } else {
+                    Database database = getHiveDatabase(databaseName);
+                    database.setName(newDatabaseName);
+                    client.alterDatabase(databaseName, database);

Review comment:
       Hey @YesOrNo828 , thanks for your suggestion! Sorry I didn't realized 
that before, I just updated this PR.




-- 
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: issues-unsubscr...@flink.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to