FANNG1 commented on code in PR #4349:
URL: https://github.com/apache/gravitino/pull/4349#discussion_r1703495556
##########
catalogs/catalog-lakehouse-paimon/src/main/java/org/apache/gravitino/catalog/lakehouse/paimon/PaimonCatalogOperations.java:
##########
@@ -457,4 +482,52 @@ private NameIdentifier
buildPaimonNameIdentifier(NameIdentifier identifier) {
String[] levels = identifier.namespace().levels();
return NameIdentifier.of(levels[levels.length - 1], identifier.name());
}
+
+ /**
+ * Performs rename table change with the provided identifier.
+ *
+ * @param identifier The identifier of the table to rename.
+ * @param renameTable Table Change to modify the table name.
+ * @return The renamed {@link GravitinoPaimonTable} instance.
+ * @throws NoSuchTableException If the table with the provided identifier
does not exist.
+ * @throws IllegalArgumentException This exception will not be thrown in
this method.
+ */
+ private GravitinoPaimonTable renameTable(
+ NameIdentifier identifier, TableChange.RenameTable renameTable)
+ throws NoSuchTableException, IllegalArgumentException {
+ try {
+ paimonCatalogOps.renameTable(
+ identifier.toString(),
+ NameIdentifier.of(identifier.namespace(),
renameTable.getNewName()).toString());
+ } catch (Catalog.TableNotExistException e) {
+ throw new NoSuchTableException(e, NO_SUCH_TABLE_EXCEPTION, identifier);
+ } catch (Catalog.TableAlreadyExistException e) {
+ throw new TableAlreadyExistsException(e, TABLE_ALREADY_EXISTS_EXCEPTION,
identifier);
Review Comment:
use newTable name not original table name?
--
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]