You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by GitBox <gi...@apache.org> on 2022/07/25 07:52:03 UTC

[GitHub] [iceberg] pvary commented on a diff in pull request #5159: Drop table's root folder if the table owns it

pvary commented on code in PR #5159:
URL: https://github.com/apache/iceberg/pull/5159#discussion_r928570571


##########
hive-metastore/src/main/java/org/apache/iceberg/hive/HiveCatalog.java:
##########
@@ -171,9 +172,17 @@ public boolean dropTable(TableIdentifier identifier, boolean purge) {
             false /* throw NoSuchObjectException if the table doesn't exist */);
         return null;
       });
-
       if (purge && lastMetadata != null) {
         CatalogUtil.dropTableData(ops.io(), lastMetadata);
+
+        Boolean shouldDropFullTableFolder = Boolean.parseBoolean(lastMetadata.property(
+            TableProperties.DROP_FULL_TABLE_FOLDER,
+            String.valueOf(TableProperties.DROP_FULL_TABLE_FOLDER_DEFAULT)));
+        if (shouldDropFullTableFolder) {
+          ((HadoopFileIO) fileIO).deletePrefix(lastMetadata.location());

Review Comment:
   I this is not something we can build upon.
   See:
   ```
       this.fileIO = fileIOImpl == null ? new HadoopFileIO(conf) : CatalogUtil.loadFileIO(fileIOImpl, properties, conf);
   ```
   
   I would do something like this:
   ```
   if (fileIO instanceof SupportsPrefixOperations) {
       ((SupportsPrefixOperations) fileIO).deletePrefix(lastMetadata.location());
   }
   ```



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

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


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