This is an automated email from the ASF dual-hosted git repository. zabetak pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/hive.git
The following commit(s) were added to refs/heads/master by this push: new 053c6c3463b HIVE-28083: Enable HMS client/query cache for EXPLAIN queries (Soumyakanti Das reviewed by John Sherman, Stamatis Zampetakis) 053c6c3463b is described below commit 053c6c3463b8a49f75f28716124b1522fedcb26c Author: Soumyakanti Das <soumyakanti.das...@gmail.com> AuthorDate: Tue Feb 20 12:22:40 2024 -0800 HIVE-28083: Enable HMS client/query cache for EXPLAIN queries (Soumyakanti Das reviewed by John Sherman, Stamatis Zampetakis) Close apache/hive#5092 --- .../hadoop/hive/ql/metadata/HiveMetaStoreClientWithLocalCache.java | 5 ++--- .../org/apache/hadoop/hive/ql/parse/ExplainSemanticAnalyzer.java | 7 +++++++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/ql/src/java/org/apache/hadoop/hive/ql/metadata/HiveMetaStoreClientWithLocalCache.java b/ql/src/java/org/apache/hadoop/hive/ql/metadata/HiveMetaStoreClientWithLocalCache.java index 015895da966..750d674aa4d 100644 --- a/ql/src/java/org/apache/hadoop/hive/ql/metadata/HiveMetaStoreClientWithLocalCache.java +++ b/ql/src/java/org/apache/hadoop/hive/ql/metadata/HiveMetaStoreClientWithLocalCache.java @@ -61,7 +61,6 @@ import org.apache.hadoop.hive.metastore.api.TableStatsResult; import org.apache.hadoop.hive.metastore.api.TableValidWriteIds; import org.apache.hadoop.hive.metastore.api.UniqueConstraintsRequest; import org.apache.hadoop.hive.metastore.api.UniqueConstraintsResponse; -import org.apache.hadoop.hive.metastore.conf.MetastoreConf; import org.apache.hadoop.hive.ql.session.SessionState; import org.apache.hadoop.hive.ql.util.IncrementalObjectSizeEstimator; import org.apache.hadoop.hive.ql.util.IncrementalObjectSizeEstimator.ObjectEstimator; @@ -98,8 +97,8 @@ public class HiveMetaStoreClientWithLocalCache extends HiveMetaStoreClient imple // init cache only once if (!INITIALIZED.get()) { LOG.info("Initializing local cache in HiveMetaStoreClient..."); - maxSize = MetastoreConf.getSizeVar(conf, MetastoreConf.ConfVars.MSC_CACHE_MAX_SIZE); - recordStats = MetastoreConf.getBoolVar(conf, MetastoreConf.ConfVars.MSC_CACHE_RECORD_STATS); + maxSize = HiveConf.getSizeVar(conf, HiveConf.ConfVars.MSC_CACHE_MAX_SIZE); + recordStats = HiveConf.getBoolVar(conf, HiveConf.ConfVars.MSC_CACHE_RECORD_STATS); initSizeEstimator(); initCache(); LOG.info("Local cache initialized in HiveMetaStoreClient: {}", mscLocalCache); diff --git a/ql/src/java/org/apache/hadoop/hive/ql/parse/ExplainSemanticAnalyzer.java b/ql/src/java/org/apache/hadoop/hive/ql/parse/ExplainSemanticAnalyzer.java index ddd42d1590a..ac0b3ead9f5 100644 --- a/ql/src/java/org/apache/hadoop/hive/ql/parse/ExplainSemanticAnalyzer.java +++ b/ql/src/java/org/apache/hadoop/hive/ql/parse/ExplainSemanticAnalyzer.java @@ -282,4 +282,11 @@ public class ExplainSemanticAnalyzer extends BaseSemanticAnalyzer { } return super.skipAuthorization(); } + + @Override + public void startAnalysis() { + if (conf.getBoolVar(HiveConf.ConfVars.HIVE_OPTIMIZE_HMS_QUERY_CACHE_ENABLED)) { + queryState.createHMSCache(); + } + } }