pvary commented on a change in pull request #2191:
URL: https://github.com/apache/iceberg/pull/2191#discussion_r569294619
##########
File path: mr/src/main/java/org/apache/iceberg/mr/hive/HiveIcebergMetaHook.java
##########
@@ -171,11 +171,22 @@ public void
rollbackDropTable(org.apache.hadoop.hive.metastore.api.Table hmsTabl
@Override
public void commitDropTable(org.apache.hadoop.hive.metastore.api.Table
hmsTable, boolean deleteData) {
if (deleteData && deleteIcebergTable) {
- if (!Catalogs.hiveCatalog(conf)) {
- LOG.info("Dropping with purge all the data for table {}.{}",
hmsTable.getDbName(), hmsTable.getTableName());
- Catalogs.dropTable(conf, catalogProperties);
- } else {
- CatalogUtil.dropTableData(deleteIo, deleteMetadata);
+ try {
+ if (!Catalogs.hiveCatalog(conf)) {
+ LOG.info("Dropping with purge all the data for table {}.{}",
hmsTable.getDbName(), hmsTable.getTableName());
+ Catalogs.dropTable(conf, catalogProperties);
+ } else {
+ // if metadata folder has been deleted already (Hive 4 behaviour for
purge=TRUE), simply return
+ if (!deleteIo.newInputFile(deleteMetadata.location()).exists()) {
Review comment:
nit: Why not:
```
if (deleteIo.newInputFile(deleteMetadata.location()).exists()) {
CatalogUtil.dropTableData(deleteIo, deleteMetadata);
}
```
This way we can avoid returning in the middle of the code which is often
hard to read, also maybe it is easier to understand.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]