You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by jd...@apache.org on 2018/06/21 17:22:17 UTC
hive git commit: HIVE-19892: Disable query results cache for for
HiveServer2 doAs=true (Jason Dere, reviewed by Sergey Shelukhin)
Repository: hive
Updated Branches:
refs/heads/master 596edd181 -> 9cd3960d0
HIVE-19892: Disable query results cache for for HiveServer2 doAs=true (Jason Dere, reviewed by Sergey Shelukhin)
Project: http://git-wip-us.apache.org/repos/asf/hive/repo
Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/9cd3960d
Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/9cd3960d
Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/9cd3960d
Branch: refs/heads/master
Commit: 9cd3960d0aebccae05682ef2f52a81affaf8c201
Parents: 596edd1
Author: Jason Dere <jd...@hortonworks.com>
Authored: Thu Jun 21 10:21:54 2018 -0700
Committer: Jason Dere <jd...@hortonworks.com>
Committed: Thu Jun 21 10:21:54 2018 -0700
----------------------------------------------------------------------
.../hadoop/hive/ql/cache/results/QueryResultsCache.java | 6 ++++++
.../org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java | 7 ++++++-
2 files changed, 12 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hive/blob/9cd3960d/ql/src/java/org/apache/hadoop/hive/ql/cache/results/QueryResultsCache.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/cache/results/QueryResultsCache.java b/ql/src/java/org/apache/hadoop/hive/ql/cache/results/QueryResultsCache.java
index 11b9c27..d29c4da 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/cache/results/QueryResultsCache.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/cache/results/QueryResultsCache.java
@@ -540,6 +540,12 @@ public final class QueryResultsCache {
} else {
// No actual result directory, no need to move anything.
cachedResultsPath = zeroRowsPath;
+ // Even if there are no results to move, at least check that we have permission
+ // to check the existence of zeroRowsPath, or the read using the cache will fail.
+ // A failure here will cause this query to not be added to the cache.
+ FileSystem cacheFs = cachedResultsPath.getFileSystem(conf);
+ boolean fakePathExists = cacheFs.exists(zeroRowsPath);
+
resultSize = 0;
requiresMove = false;
}
http://git-wip-us.apache.org/repos/asf/hive/blob/9cd3960d/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java
----------------------------------------------------------------------
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 c2bcedd..867ffe4 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
@@ -12130,7 +12130,7 @@ public class SemanticAnalyzer extends BaseSemanticAnalyzer {
// 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()) {
@@ -14658,6 +14658,11 @@ public class SemanticAnalyzer extends BaseSemanticAnalyzer {
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.