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


##########
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:
   I kept consistent with origin logic. Origin logic will reuse the method 
`loadTable`.  Could we simplify the code ? We don't need to consider the cases 
the identifier may include a snapshot selector or may point to change log. The 
upper layer usually to verify the table existence before creating ,altering or 
dropping tables.  The identifiers of altering, creating or dropping tables 
don't contain snapshot selector or pointer of change log.
   



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