smallx commented on a change in pull request #3861:
URL: https://github.com/apache/iceberg/pull/3861#discussion_r781149649



##########
File path: 
spark/v3.0/spark/src/main/java/org/apache/iceberg/spark/SparkSessionCatalog.java
##########
@@ -123,11 +123,10 @@ public Table loadTable(Identifier ident) throws 
NoSuchTableException {
 
   @Override
   public void invalidateTable(Identifier ident) {
-    if (icebergCatalog.tableExists(ident)) {
-      icebergCatalog.invalidateTable(ident);
-    } else {
-      getSessionCatalog().invalidateTable(ident);
-    }
+    // We do not need to check whether the table exists and whether
+    // it is an Iceberg table to reduce remote service requests.
+    icebergCatalog.invalidateTable(ident);

Review comment:
       > What about updating invalidateTable to return true if a table was 
removed from the cache?
   
   I have updated `Catalog.invalidateTable` to return whether the table is 
cached. However, due to Spark's `TableCatalog.invalidateTable` has no return 
value, I have to add `invalidateTableIfCached` method to `BaseCatalog` to 
workaround it.




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