hive-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ser...@apache.org
Subject [2/2] hive git commit: HIVE-14072 : QueryIds reused across different queries (Sergey Shelukhin, reviewed by Vaibhav Gumashta)
Date Sat, 02 Jul 2016 02:09:58 GMT
HIVE-14072 : QueryIds reused across different queries (Sergey Shelukhin, reviewed by Vaibhav
Gumashta)


Project: http://git-wip-us.apache.org/repos/asf/hive/repo
Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/68e8ee0b
Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/68e8ee0b
Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/68e8ee0b

Branch: refs/heads/branch-2.1
Commit: 68e8ee0b18ca2906e8eda266f480086548f9e844
Parents: 7fbb722
Author: Sergey Shelukhin <sershe@apache.org>
Authored: Fri Jul 1 18:59:55 2016 -0700
Committer: Sergey Shelukhin <sershe@apache.org>
Committed: Fri Jul 1 19:02:55 2016 -0700

----------------------------------------------------------------------
 .../java/org/apache/hadoop/hive/ql/QTestUtil.java     |  1 +
 ql/src/java/org/apache/hadoop/hive/ql/Driver.java     | 14 +++++++++++---
 .../hive/ql/processors/CommandProcessorFactory.java   |  2 ++
 .../apache/hive/service/cli/operation/Operation.java  |  4 ----
 .../hive/service/cli/operation/SQLOperation.java      |  4 ++++
 .../service/cli/operation/SQLOperationDisplay.java    |  2 +-
 6 files changed, 19 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hive/blob/68e8ee0b/itests/util/src/main/java/org/apache/hadoop/hive/ql/QTestUtil.java
----------------------------------------------------------------------
diff --git a/itests/util/src/main/java/org/apache/hadoop/hive/ql/QTestUtil.java b/itests/util/src/main/java/org/apache/hadoop/hive/ql/QTestUtil.java
index 11e529d..fa68b75 100644
--- a/itests/util/src/main/java/org/apache/hadoop/hive/ql/QTestUtil.java
+++ b/itests/util/src/main/java/org/apache/hadoop/hive/ql/QTestUtil.java
@@ -1656,6 +1656,7 @@ public class QTestUtil {
   public void resetParser() throws SemanticException {
     drv.init();
     pd = new ParseDriver();
+    queryState = new QueryState(conf);
     sem = new SemanticAnalyzer(queryState);
   }
 

http://git-wip-us.apache.org/repos/asf/hive/blob/68e8ee0b/ql/src/java/org/apache/hadoop/hive/ql/Driver.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/Driver.java b/ql/src/java/org/apache/hadoop/hive/ql/Driver.java
index 2263192..553260f 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/Driver.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/Driver.java
@@ -299,9 +299,6 @@ public class Driver implements CommandProcessor {
         SessionState.get().getConf() : new HiveConf()), null);
   }
 
-  /**
-   * for backwards compatibility with current tests
-   */
   public Driver(HiveConf conf) {
     this(new QueryState(conf), null);
   }
@@ -2029,4 +2026,15 @@ public class Driver implements CommandProcessor {
   public void setOperationId(String opId) {
     this.operationId = opId;
   }
+
+  /** 
+   * Resets QueryState to get new queryId on Driver reuse.
+   */
+  public void resetQueryState() {
+    // Note: Driver cleanup for reuse at this point is not very clear. The assumption here
is that
+    // repeated compile/execute calls create new contexts, plan, etc., so we don't need to
worry
+    // propagating queryState into those existing fields, or resetting them.
+    releaseResources();
+    this.queryState = new QueryState(queryState.getConf());
+  }
 }

http://git-wip-us.apache.org/repos/asf/hive/blob/68e8ee0b/ql/src/java/org/apache/hadoop/hive/ql/processors/CommandProcessorFactory.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/processors/CommandProcessorFactory.java
b/ql/src/java/org/apache/hadoop/hive/ql/processors/CommandProcessorFactory.java
index c343b0e..e61864e 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/processors/CommandProcessorFactory.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/processors/CommandProcessorFactory.java
@@ -120,6 +120,8 @@ public final class CommandProcessorFactory {
       if (drv == null) {
         drv = new Driver();
         mapDrivers.put(conf, drv);
+      } else {
+        drv.resetQueryState();
       }
       drv.init();
       return drv;

http://git-wip-us.apache.org/repos/asf/hive/blob/68e8ee0b/service/src/java/org/apache/hive/service/cli/operation/Operation.java
----------------------------------------------------------------------
diff --git a/service/src/java/org/apache/hive/service/cli/operation/Operation.java b/service/src/java/org/apache/hive/service/cli/operation/Operation.java
index 0932884..4e56ea5 100644
--- a/service/src/java/org/apache/hive/service/cli/operation/Operation.java
+++ b/service/src/java/org/apache/hive/service/cli/operation/Operation.java
@@ -104,10 +104,6 @@ public abstract class Operation {
     queryState = new QueryState(parentSession.getHiveConf(), confOverlay, runAsync);
   }
 
-  public QueryState getQueryState() {
-    return queryState;
-  }
-
   public Future<?> getBackgroundHandle() {
     return backgroundHandle;
   }

http://git-wip-us.apache.org/repos/asf/hive/blob/68e8ee0b/service/src/java/org/apache/hive/service/cli/operation/SQLOperation.java
----------------------------------------------------------------------
diff --git a/service/src/java/org/apache/hive/service/cli/operation/SQLOperation.java b/service/src/java/org/apache/hive/service/cli/operation/SQLOperation.java
index 33f95fb..4f8883f 100644
--- a/service/src/java/org/apache/hive/service/cli/operation/SQLOperation.java
+++ b/service/src/java/org/apache/hive/service/cli/operation/SQLOperation.java
@@ -655,4 +655,8 @@ public class SQLOperation extends ExecuteStatementOperation {
       }
     }
   }
+
+  public String getExecutionEngine() {
+    return queryState.getConf().getVar(HiveConf.ConfVars.HIVE_EXECUTION_ENGINE);
+  }
 }

http://git-wip-us.apache.org/repos/asf/hive/blob/68e8ee0b/service/src/java/org/apache/hive/service/cli/operation/SQLOperationDisplay.java
----------------------------------------------------------------------
diff --git a/service/src/java/org/apache/hive/service/cli/operation/SQLOperationDisplay.java
b/service/src/java/org/apache/hive/service/cli/operation/SQLOperationDisplay.java
index c521706..3cfeccc 100644
--- a/service/src/java/org/apache/hive/service/cli/operation/SQLOperationDisplay.java
+++ b/service/src/java/org/apache/hive/service/cli/operation/SQLOperationDisplay.java
@@ -41,7 +41,7 @@ public class SQLOperationDisplay {
   public SQLOperationDisplay(SQLOperation sqlOperation) throws HiveSQLException {
     this.state = sqlOperation.getState();
     this.userName = sqlOperation.getParentSession().getUserName();
-    this.executionEngine = sqlOperation.getQueryState().getConf().getVar(HiveConf.ConfVars.HIVE_EXECUTION_ENGINE);
+    this.executionEngine = sqlOperation.getExecutionEngine();
     this.beginTime = System.currentTimeMillis();
     this.operationId = sqlOperation.getHandle().getHandleIdentifier().toString();
   }


Mime
View raw message