SteNicholas commented on code in PR #958:
URL: https://github.com/apache/incubator-paimon/pull/958#discussion_r1173306176


##########
paimon-core/src/main/java/org/apache/paimon/catalog/FileSystemCatalog.java:
##########
@@ -99,6 +99,24 @@ public void dropDatabase(String name, boolean 
ignoreIfNotExists, boolean cascade
         uncheck(() -> fileIO.delete(databasePath(name), true));
     }
 
+    @Override
+    public void renameDatabase(String fromDatabase, String toDatabase, boolean 
ignoreIfNotExists)
+            throws DatabaseNotExistException, DatabaseAlreadyExistException {
+        if (!databaseExists(fromDatabase)) {
+            if (ignoreIfNotExists) {
+                return;
+            }
+
+            throw new DatabaseNotExistException(fromDatabase);
+        }
+
+        if (databaseExists(toDatabase)) {
+            throw new DatabaseAlreadyExistException(toDatabase);
+        }
+
+        uncheck(() -> fileIO.rename(databasePath(fromDatabase), 
databasePath(toDatabase)));

Review Comment:
   IMO, there is no way to aware of database name change, therefore the 
`renameDatabase` depend on the write path listener which we could introduce the 
listener to update the path of writer.



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