RussellSpitzer opened a new issue #3051:
URL: https://github.com/apache/iceberg/issues/3051


   Currently we define our drop table method here
   
   
https://github.com/apache/iceberg/blob/237b72daa211f0404b72d4cd142b4a49be33a1f0/api/src/main/java/org/apache/iceberg/catalog/Catalog.java#L277-L285
   
   Saying that we need to return "false" if a table does not exist but the 
underlying delete method in hadoop only returns true unless an exception occurs 
when attempting to delete the underlying file. 
   
   
https://github.com/apache/iceberg/blob/237b72daa211f0404b72d4cd142b4a49be33a1f0/core/src/main/java/org/apache/iceberg/hadoop/HadoopCatalog.java#L268-L269
   
   Most hadoop FS implementations I checked swallow all FileNotFound and 
associated exceptions and just return false.
   
   
https://github.com/apache/hadoop/blob/50dda774f13a83547e41db4e835d7106ae66c1ff/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/ChecksumFileSystem.java#L723-L728
   
   We should probably be returning the output of fs.delete like we do in 
dropNamespace 
   
https://github.com/apache/iceberg/blob/237b72daa211f0404b72d4cd142b4a49be33a1f0/core/src/main/java/org/apache/iceberg/hadoop/HadoopCatalog.java#L347
   
   I think additionally we should probably do a check that the 
HadoopTableOperations can actually fine a metadata.json file before considering 
the table an Iceberg table. As is, the delete command can register a deleted 
table even if there is no iceberg table at that location if a folder exists in 
the warehouse directory.
   
   Perhaps we should be doing 
   
   ```java
   // lastMetadata is only null if no metadata.json exists in this directory 
specified by the table
   return lastMetadata != null && fs.delete(tablePath, true /* recursive */);
   ```
   
   


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