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



##########
File path: core/src/main/java/org/apache/iceberg/hadoop/HadoopCatalog.java
##########
@@ -247,26 +247,25 @@ protected String defaultWarehouseLocation(TableIdentifier 
tableIdentifier) {
   @Override
   public boolean dropTable(TableIdentifier identifier, boolean purge) {
     if (!isValidIdentifier(identifier)) {
-      throw new NoSuchTableException("Invalid identifier: %s", identifier);
+      LOG.error("Invalid identifier: %s", identifier);
+      return false;
     }
 
     Path tablePath = new Path(defaultWarehouseLocation(identifier));
     TableOperations ops = newTableOps(identifier);
-    TableMetadata lastMetadata;
-    if (purge && ops.current() != null) {
-      lastMetadata = ops.current();
-    } else {
-      lastMetadata = null;
+    TableMetadata lastMetadata = ops.current();
+    if (lastMetadata == null) {
+      LOG.error("Not an iceberg table: %s", identifier);
+      return false;

Review comment:
       I would prefer keeping the returns in the same if block as the other 
return statement. I tend to always lean towards single or very closely located 
exits from functions so it's clear that you either return this or that.
   
   Like if you had it as
   ```
   if (lastMetadata == null) {
     LOG.error(....)
     return false
   } else {
     return fs.delete(...)
   }
   ```




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