RussellSpitzer commented on a change in pull request #3056:
URL: https://github.com/apache/iceberg/pull/3056#discussion_r804830153



##########
File path: 
spark/v3.2/spark/src/main/java/org/apache/iceberg/spark/SparkCatalog.java
##########
@@ -244,10 +244,19 @@ public SparkTable alterTable(Identifier ident, 
TableChange... changes) throws No
 
   @Override
   public boolean dropTable(Identifier ident) {
+    return dropTableInternal(ident, false);
+  }
+
+  @Override
+  public boolean purgeTable(Identifier ident) {
+    return dropTableInternal(ident, true);
+  }
+
+  private boolean dropTableInternal(Identifier ident, boolean purge) {
     try {
       return isPathIdentifier(ident) ?
-          tables.dropTable(((PathIdentifier) ident).location()) :
-          icebergCatalog.dropTable(buildIdentifier(ident));
+          tables.dropTable(((PathIdentifier) ident).location(), purge) :

Review comment:
       To elaborate on this, we have a table property GC_ENABLED which we use 
to signify that a table identifier may not have full ownership of all the data 
files it references. When this flag is enabled we disable Iceberg operations 
which can phyiscally delete files like EXPIRE_SNAPSHOTS and 
REMOVE_ORPHAN_FILES. I feel like DROP TABLE PURGE is probably very similar and 
it should be blocked.
   
   An example would be a user creating a Snapshot of another table, then 
dropping it with purge. We wouldn't want to delete files owned by the original 
table which has been snapshotted.




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

Reply via email to