nastra commented on code in PR #12159:
URL: https://github.com/apache/iceberg/pull/12159#discussion_r1959224261


##########
core/src/main/java/org/apache/iceberg/rest/RESTSessionCatalog.java:
##########
@@ -428,7 +429,19 @@ public void renameTable(SessionContext context, 
TableIdentifier from, TableIdent
     Endpoint.check(endpoints, Endpoint.V1_RENAME_TABLE);
     checkIdentifierIsValid(from);
     checkIdentifierIsValid(to);
+    try {
+      renameInternal(context, from, to);
+    } catch (NoSuchNamespaceException e) {
+      if (name().equals(to.namespace().level(0)) && to.namespace().length() > 
1) {
+        Namespace namespace =
+            Namespace.of(Arrays.copyOfRange(to.namespace().levels(), 1, 
to.namespace().length()));
+        TableIdentifier toWithStrippingCatalog = TableIdentifier.of(namespace, 
to.name());
+        renameInternal(context, from, toWithStrippingCatalog);
+      }

Review Comment:
   this needs to `throw e` in case we didn't reach the if block. Also I believe 
we need to apply the same logic to `renameView`



-- 
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...@iceberg.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org
For additional commands, e-mail: issues-h...@iceberg.apache.org

Reply via email to