talatuyarer commented on code in PR #17873:
URL: https://github.com/apache/iceberg/pull/17873#discussion_r3995349292
##########
flink/v2.3/flink/src/main/java/org/apache/iceberg/flink/FlinkCatalog.java:
##########
@@ -401,17 +468,48 @@ public void renameTable(ObjectPath tablePath, String
newTableName, boolean ignor
toIdentifier(tablePath),
toIdentifier(new ObjectPath(tablePath.getDatabaseName(),
newTableName)));
} catch (org.apache.iceberg.exceptions.NoSuchTableException e) {
+ if (canBeView(tablePath)) {
+ try {
+ asViewCatalog.renameView(
+ toIdentifier(tablePath),
+ toIdentifier(new ObjectPath(tablePath.getDatabaseName(),
newTableName)));
+ return;
+ } catch (NoSuchViewException viewException) {
+ e.addSuppressed(viewException);
+ } catch (AlreadyExistsException alreadyExistsException) {
+ throw new TableAlreadyExistException(
+ getName(),
+ new ObjectPath(tablePath.getDatabaseName(), newTableName),
+ alreadyExistsException);
+ }
+ }
+
if (!ignoreIfNotExists) {
throw new TableNotExistException(getName(), tablePath, e);
}
} catch (AlreadyExistsException e) {
- throw new TableAlreadyExistException(getName(), tablePath, e);
+ throw new TableAlreadyExistException(
+ getName(), new ObjectPath(tablePath.getDatabaseName(),
newTableName), e);
}
}
@Override
public void createTable(ObjectPath tablePath, CatalogBaseTable table,
boolean ignoreIfExists)
throws CatalogException, TableAlreadyExistException {
+ if (table instanceof CatalogView) {
+ if (asViewCatalog == null) {
+ throw new UnsupportedOperationException(
Review Comment:
Added testCreateViewNotSupportedByCatalog
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]