kevinjqliu commented on code in PR #14457:
URL: https://github.com/apache/iceberg/pull/14457#discussion_r2488396405


##########
spark/v4.0/spark/src/main/java/org/apache/iceberg/spark/SparkCatalog.java:
##########
@@ -234,6 +234,61 @@ public Table loadTable(Identifier ident, long timestamp) 
throws NoSuchTableExcep
     }
   }
 
+  @Override
+  public boolean tableExists(Identifier ident) {
+    try {
+      if (isPathIdentifier(ident)) {
+        loadFromPathIdentifier((PathIdentifier) ident);
+        return true;
+      } else {
+        boolean isExists = icebergCatalog.tableExists(buildIdentifier(ident));
+        if (isExists) {
+          return true;
+        }
+
+        // if the original load didn't work, try using the namespace as an 
identifier because

Review Comment:
   could we reuse the `load` logic here? 
   ```
   @Override
   public boolean tableExists(Identifier ident) {
     if (isPathIdentifier(ident)) {
       try {
         tables.load(((PathIdentifier) ident).location());
         return true;
       } catch (org.apache.iceberg.exceptions.NoSuchTableException e) {
         return false;
       }
     } else {
       return icebergCatalog.tableExists(buildIdentifier(ident));
     }
   }
   ```
   
   If this gets too complicated, feel free to ignore my comment and lets just 
move forward with only the `SparkSessionCatalog` change
   



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