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


##########
nessie/src/main/java/org/apache/iceberg/nessie/NessieIcebergClient.java:
##########
@@ -448,33 +473,82 @@ public void renameTable(TableIdentifier from, 
TableIdentifier to) {
     // behavior. So better be safe than sorry.
   }
 
+  private static void validateToContentForRename(
+      TableIdentifier from, TableIdentifier to, IcebergContent 
existingToContent) {
+    if (existingToContent != null) {
+      if (existingToContent.getType() == Content.Type.ICEBERG_VIEW) {
+        throw new AlreadyExistsException("Cannot rename %s to %s. View already 
exists", from, to);
+      } else if (existingToContent.getType() == Content.Type.ICEBERG_TABLE) {
+        throw new AlreadyExistsException("Cannot rename %s to %s. Table 
already exists", from, to);
+      } else {
+        throw new AlreadyExistsException(
+            "Cannot rename %s to %s. Another content with same name already 
exists", from, to);

Review Comment:
   nit: should this maybe mention the content type here?



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