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


##########
nessie/src/main/java/org/apache/iceberg/nessie/NessieIcebergClient.java:
##########
@@ -378,27 +420,63 @@ public void renameTable(TableIdentifier from, 
TableIdentifier to) {
     // behavior. So better be safe than sorry.
   }
 
+  private void validateContentForRename(
+      TableIdentifier from,
+      TableIdentifier to,
+      boolean isView,
+      IcebergContent existingFromContent) {
+    if (existingFromContent == null) {
+      if (isView) {
+        throw new NoSuchViewException("View does not exist: %s", from);
+      } else {
+        throw new NoSuchTableException("Table does not exist: %s", from);
+      }
+    }
+
+    IcebergContent existingToContent = isView ? view(to) : table(to);
+    if (existingToContent != null) {
+      if (isView) {
+        throw new AlreadyExistsException("Cannot rename %s to %s. View already 
exists", from, to);
+      } else {
+        throw new AlreadyExistsException("Cannot rename %s to %s. Table 
already exists", from, to);
+      }
+    }
+  }
+
   public boolean dropTable(TableIdentifier identifier, boolean purge) {
+    return dropContent(identifier, purge, false);
+  }
+
+  public boolean dropView(TableIdentifier identifier, boolean purge) {
+    return dropContent(identifier, purge, true);
+  }
+
+  private boolean dropContent(TableIdentifier identifier, boolean purge, 
boolean isView) {

Review Comment:
   rather than passing a boolean flag, maybe just pass the content type?



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