You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by "RussellSpitzer (via GitHub)" <gi...@apache.org> on 2023/04/04 21:39:45 UTC

[GitHub] [iceberg] RussellSpitzer commented on a diff in pull request #7228: Fix for Drop SQL issue when attempting to drop an Iceberg table

RussellSpitzer commented on code in PR #7228:
URL: https://github.com/apache/iceberg/pull/7228#discussion_r1157795034


##########
spark/v3.3/spark/src/main/java/org/apache/iceberg/spark/SparkSessionCatalog.java:
##########
@@ -134,28 +135,34 @@ public Identifier[] listTables(String[] namespace) throws NoSuchNamespaceExcepti
 
   @Override
   public Table loadTable(Identifier ident) throws NoSuchTableException {
-    try {
-      return icebergCatalog.loadTable(ident);
-    } catch (NoSuchTableException e) {
-      return getSessionCatalog().loadTable(ident);
-    }
+    return loadTableInternal(ident, null, null);
   }
 
   @Override
   public Table loadTable(Identifier ident, String version) throws NoSuchTableException {
-    try {
-      return icebergCatalog.loadTable(ident, version);
-    } catch (org.apache.iceberg.exceptions.NoSuchTableException e) {
-      return getSessionCatalog().loadTable(ident, version);
-    }
+    return loadTableInternal(ident, version, null);
   }
 
   @Override
   public Table loadTable(Identifier ident, long timestamp) throws NoSuchTableException {
+    return loadTableInternal(ident, null, timestamp);
+  }
+
+  private Table loadTableInternal(Identifier ident, String version, Long timestamp)
+      throws NoSuchTableException {
     try {
-      return icebergCatalog.loadTable(ident, timestamp);
+      return loadTable(icebergCatalog, ident, version, timestamp);
     } catch (org.apache.iceberg.exceptions.NoSuchTableException e) {
-      return getSessionCatalog().loadTable(ident, timestamp);
+      return loadTable(getSessionCatalog(), ident, version, timestamp);
+    } catch (org.apache.iceberg.exceptions.NotFoundException e) {
+      if (loadCatalogTableWhenMetadataNotFoundEnabled()) {

Review Comment:
   We discussed possibly just overriding tableExists so that if we have a "unable to read file exception" from loadTable we can still say the table exists as an Iceberg table. Further catalog attempts to use the table would fail, but delete would succeed. If we want we could also gate that behind session param.



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