shenzhu commented on a change in pull request #17831:
URL: https://github.com/apache/flink/pull/17831#discussion_r754702274
##########
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 @JingsongLi , thanks for assigning this ticket to me!
I implemented `renameDatabase` function in `HiveCatalog`, however, [one of
the tests I
added](https://github.com/apache/flink/pull/17831/files#diff-3085e843995d9bd0b96921113b3eb99625d8fe4f187b3c2639cb7c2845ad373bR274)
is failing, seems `client.alterDatabase(databaseName, database)` is not
working as expected. I'm not sure if there's anything else I could do to update
the database name, would you mind taking a look to see if I made any mistakes
in this implementation?
Thanks for your help!
--
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]