okumin commented on code in PR #5882: URL: https://github.com/apache/hive/pull/5882#discussion_r2250543039
########## standalone-metastore/metastore-rest-catalog/src/main/java/org/apache/iceberg/rest/HMSCachingCatalog.java: ########## @@ -35,24 +36,22 @@ import org.apache.iceberg.hive.HiveCatalog; import org.apache.iceberg.view.View; import org.apache.iceberg.view.ViewBuilder; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * Class that wraps an Iceberg Catalog to cache tables. */ public class HMSCachingCatalog extends CachingCatalog implements SupportsNamespaces, ViewCatalog { + private static final Logger LOG = LoggerFactory.getLogger(HMSCachingCatalog.class); private final HiveCatalog hiveCatalog; public HMSCachingCatalog(HiveCatalog catalog, long expiration) { - super(catalog, true, expiration, Ticker.systemTicker()); + super(catalog, false, expiration, Ticker.systemTicker()); Review Comment: I'm curious about pros vs cons of the case sensitivity here. ########## standalone-metastore/metastore-rest-catalog/src/main/java/org/apache/iceberg/rest/HMSCachingCatalog.java: ########## @@ -63,6 +62,27 @@ public List<Namespace> listNamespaces(Namespace nmspc) throws NoSuchNamespaceExc return hiveCatalog.listNamespaces(nmspc); } + @Override + public Table loadTable(TableIdentifier identifier) { + TableIdentifier canonicalIdentifier = identifier.toLowerCase(); + Table cachedTable = tableCache.getIfPresent(canonicalIdentifier); + if (cachedTable != null) { + String location = hiveCatalog.getTableLocation(canonicalIdentifier); + if (location == null) { + LOG.debug("Table {} has no location, returning cached table without location", canonicalIdentifier); + } else if (!location.equals(cachedTable.location())) { + LOG.debug("Cached table {} has a different location than the one in the catalog: {} != {}", + canonicalIdentifier, cachedTable.location(), location); + } else { + LOG.debug("Returning cached table: {}", canonicalIdentifier); + return cachedTable; + } + // Invalidate the cached table if the location is different + tableCache.invalidate(cachedTable); Review Comment: I guess it's a little more robust to use `CachingCatalog#invalidateTable`. Please correct me if the current implementation is intentional. https://github.com/apache/iceberg/blob/apache-iceberg-1.9.2/core/src/main/java/org/apache/iceberg/CachingCatalog.java#L186-L191 -- 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