henrib commented on code in PR #6022:
URL: https://github.com/apache/hive/pull/6022#discussion_r2272813304


##########
standalone-metastore/metastore-rest-catalog/src/main/java/org/apache/iceberg/rest/HMSCachingCatalog.java:
##########
@@ -63,6 +69,96 @@ public List<Namespace> listNamespaces(Namespace nmspc) 
throws NoSuchNamespaceExc
     return hiveCatalog.listNamespaces(nmspc);
   }
 
+  protected void cacheInvalidateInc(TableIdentifier tid) {
+    // This method is intentionally left empty. It can be overridden in 
subclasses if needed.
+  }
+
+  protected void cacheLoadInc(TableIdentifier tid) {
+    // This method is intentionally left empty. It can be overridden in 
subclasses if needed.
+  }
+
+  protected void cacheHitInc(TableIdentifier tid) {
+    // This method is intentionally left empty. It can be overridden in 
subclasses if needed.
+  }
+
+  protected void cacheMissInc(TableIdentifier tid) {
+    // This method is intentionally left empty. It can be overridden in 
subclasses if needed.
+  }
+
+  protected void cacheMetaLoadInc(TableIdentifier tid) {
+    // This method is intentionally left empty. It can be overridden in 
subclasses if needed.
+  }
+
+  /**
+   * Gets the metadata file location of a table.
+   *
+   * @param table the table
+   * @return the location of the metadata file, or null if the table does not 
have a location
+   */
+  protected static String getMetadataLocation(final Table table) {
+    if (table instanceof HasTableOperations tableOps) {
+      final TableOperations ops = tableOps.operations();
+      final TableMetadata meta;
+      if (ops != null && (meta = ops.current()) != null) {
+        return meta.metadataFileLocation();
+      }
+    }
+    return null;
+  }
+
+  @Override
+  public Table loadTable(final TableIdentifier identifier) {
+    final Cache<TableIdentifier, Table> cache = this.tableCache;
+    final HiveCatalog catalog = this.hiveCatalog;
+    final TableIdentifier canonicalized = identifier.toLowerCase();
+    Table cachedTable = cache.getIfPresent(canonicalized);
+    if (cachedTable != null) {
+      final String location = catalog.getTableMetadataLocation(canonicalized);

Review Comment:
   Wouldn't this imply the cache is rematerializing a table object to verify it 
might have avoided 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: gitbox-unsubscr...@hive.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscr...@hive.apache.org
For additional commands, e-mail: gitbox-h...@hive.apache.org

Reply via email to