diff --git a/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java b/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java index 2e055aba4b..521afe6231 100644 --- a/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java +++ b/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java @@ -12129,7 +12129,7 @@ void analyzeInternal(ASTNode ast, PlannerContextFactory pcf) throws SemanticExce // If no masking/filtering required, then we can check the cache now, before // generating the operator tree and going through CBO. // Otherwise we have to wait until after the masking/filtering step. - boolean isCacheEnabled = conf.getBoolVar(HiveConf.ConfVars.HIVE_QUERY_RESULTS_CACHE_ENABLED); + boolean isCacheEnabled = isResultsCacheEnabled(); QueryResultsCache.LookupInfo lookupInfo = null; boolean needsTransform = needsTransform(); if (isCacheEnabled && !needsTransform && queryTypeCanUseCache()) { @@ -14659,6 +14659,11 @@ public ValidTxnWriteIdList get() { return lookupInfo; } + private boolean isResultsCacheEnabled() { + return conf.getBoolVar(HiveConf.ConfVars.HIVE_QUERY_RESULTS_CACHE_ENABLED) && + !(SessionState.get().isHiveServerQuery() && conf.getBoolVar(HiveConf.ConfVars.HIVE_SERVER2_ENABLE_DOAS)); + } + /** * Set the query plan to use cache entry passed in to return the query results. * @param cacheEntry The results cache entry that will be used to resolve the query.