hive-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vik...@apache.org
Subject hive git commit: HIVE-13286: Query ID is being reused across queries (Aihua Xu via Vikram Dixit K)
Date Tue, 22 Mar 2016 20:55:41 GMT
Repository: hive
Updated Branches:
  refs/heads/master f971b191f -> 8f27cfe3c


HIVE-13286: Query ID is being reused across queries (Aihua Xu via Vikram Dixit K)


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

Branch: refs/heads/master
Commit: 8f27cfe3c2a5fac914e2521eb6ddce87a5c1cbb7
Parents: f971b19
Author: vikram <vikram@hortonworks.com>
Authored: Tue Mar 22 13:41:37 2016 -0700
Committer: vikram <vikram@hortonworks.com>
Committed: Tue Mar 22 13:55:32 2016 -0700

----------------------------------------------------------------------
 cli/src/java/org/apache/hadoop/hive/cli/CliDriver.java |  3 +++
 .../hive/service/cli/session/TestHiveSessionImpl.java  |  5 +++--
 ql/src/java/org/apache/hadoop/hive/ql/Driver.java      |  6 ------
 .../hive/service/cli/session/HiveSessionImpl.java      | 13 ++++++-------
 4 files changed, 12 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hive/blob/8f27cfe3/cli/src/java/org/apache/hadoop/hive/cli/CliDriver.java
----------------------------------------------------------------------
diff --git a/cli/src/java/org/apache/hadoop/hive/cli/CliDriver.java b/cli/src/java/org/apache/hadoop/hive/cli/CliDriver.java
index b6fe77c..2bcb56d 100644
--- a/cli/src/java/org/apache/hadoop/hive/cli/CliDriver.java
+++ b/cli/src/java/org/apache/hadoop/hive/cli/CliDriver.java
@@ -68,6 +68,7 @@ import org.apache.hadoop.hive.conf.HiveConf.ConfVars;
 import org.apache.hadoop.hive.metastore.api.FieldSchema;
 import org.apache.hadoop.hive.ql.CommandNeedRetryException;
 import org.apache.hadoop.hive.ql.Driver;
+import org.apache.hadoop.hive.ql.QueryPlan;
 import org.apache.hadoop.hive.ql.exec.FunctionRegistry;
 import org.apache.hadoop.hive.ql.exec.mr.HadoopJobExecHelper;
 import org.apache.hadoop.hive.ql.exec.tez.TezJobExecHelper;
@@ -120,6 +121,8 @@ public class CliDriver {
 
     ss.updateThreadName();
 
+    conf.set(HiveConf.ConfVars.HIVEQUERYID.varname, QueryPlan.makeQueryId());
+
     // Flush the print stream, so it doesn't include output from the last command
     ss.err.flush();
     String cmd_trimmed = cmd.trim();

http://git-wip-us.apache.org/repos/asf/hive/blob/8f27cfe3/itests/hive-unit/src/test/java/org/apache/hive/service/cli/session/TestHiveSessionImpl.java
----------------------------------------------------------------------
diff --git a/itests/hive-unit/src/test/java/org/apache/hive/service/cli/session/TestHiveSessionImpl.java
b/itests/hive-unit/src/test/java/org/apache/hive/service/cli/session/TestHiveSessionImpl.java
index 4b23385..4d763d2 100644
--- a/itests/hive-unit/src/test/java/org/apache/hive/service/cli/session/TestHiveSessionImpl.java
+++ b/itests/hive-unit/src/test/java/org/apache/hive/service/cli/session/TestHiveSessionImpl.java
@@ -27,6 +27,7 @@ import org.apache.hive.service.rpc.thrift.TProtocolVersion;
 import org.junit.Assert;
 import org.junit.Test;
 import org.mockito.Mockito;
+import static org.mockito.Matchers.*;
 
 import java.util.HashMap;
 import java.util.Map;
@@ -68,8 +69,8 @@ public class TestHiveSessionImpl {
     Mockito.when(operation.getHandle()).thenReturn(opHandle);
     Map<String, String> confOverlay = new HashMap<String, String>();
     String hql = "drop table if exists table_not_exists";
-    Mockito.when(operationManager.newExecuteStatementOperation(session, hql, confOverlay,
-            true)).thenReturn(operation);
+    Mockito.when(operationManager.newExecuteStatementOperation(same(session), eq(hql),
+        (Map<String, String>)Mockito.any(), eq(true))).thenReturn(operation);
 
     try {
 

http://git-wip-us.apache.org/repos/asf/hive/blob/8f27cfe3/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 7327a42..d7e4ac7 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/Driver.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/Driver.java
@@ -403,13 +403,7 @@ public class Driver implements CommandProcessor {
     }
     saveSession(queryState);
 
-    // Generate new query id if it's not set for CLI case. If it's session based,
-    // query id is passed in from the client or initialized when the session starts.
     String queryId = conf.getVar(HiveConf.ConfVars.HIVEQUERYID);
-    if (queryId == null || queryId.isEmpty()) {
-      queryId = QueryPlan.makeQueryId();
-      conf.setVar(HiveConf.ConfVars.HIVEQUERYID, queryId);
-    }
 
     //save some info for webUI for use after plan is freed
     this.queryDisplay.setQueryStr(queryStr);

http://git-wip-us.apache.org/repos/asf/hive/blob/8f27cfe3/service/src/java/org/apache/hive/service/cli/session/HiveSessionImpl.java
----------------------------------------------------------------------
diff --git a/service/src/java/org/apache/hive/service/cli/session/HiveSessionImpl.java b/service/src/java/org/apache/hive/service/cli/session/HiveSessionImpl.java
index 8baecdf..80a1844 100644
--- a/service/src/java/org/apache/hive/service/cli/session/HiveSessionImpl.java
+++ b/service/src/java/org/apache/hive/service/cli/session/HiveSessionImpl.java
@@ -438,16 +438,15 @@ public class HiveSessionImpl implements HiveSession {
           throws HiveSQLException {
     acquire(true);
 
-    // Create the queryId if the client doesn't pass in.
-    // Reuse the client's queryId if exists.
+    // Make a copy of confOverlay
     if (confOverlay == null) {
       confOverlay = new HashMap<String, String>();
+    } else {
+      Map<String, String> conf = new HashMap<String, String>();
+      conf.putAll(confOverlay);
+      confOverlay = conf;
     }
-    String queryId = confOverlay.get(HiveConf.ConfVars.HIVEQUERYID.varname);
-    if (queryId == null || queryId.isEmpty()) {
-      queryId = QueryPlan.makeQueryId();
-      confOverlay.put(HiveConf.ConfVars.HIVEQUERYID.varname, queryId);
-    }
+    confOverlay.put(HiveConf.ConfVars.HIVEQUERYID.varname, QueryPlan.makeQueryId());
 
     OperationManager operationManager = getOperationManager();
     ExecuteStatementOperation operation = operationManager


Mime
View raw message