You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by jx...@apache.org on 2016/05/21 22:47:33 UTC

hive git commit: HIVE-13782: Compile async query asynchronously (Jimmy Xiang, reviewed by Xuefu Zhang, Lefty Leverenz)

Repository: hive
Updated Branches:
  refs/heads/master 2c3ebf8f2 -> 2f3b1af49


HIVE-13782: Compile async query asynchronously (Jimmy Xiang, reviewed by Xuefu Zhang, Lefty Leverenz)


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

Branch: refs/heads/master
Commit: 2f3b1af495c29fb02ebef375f3af2e25c43d44f6
Parents: 2c3ebf8
Author: Jimmy Xiang <jx...@apache.org>
Authored: Wed May 18 15:05:03 2016 -0700
Committer: Jimmy Xiang <jx...@apache.org>
Committed: Sat May 21 15:47:05 2016 -0700

----------------------------------------------------------------------
 .../src/java/org/apache/hadoop/hive/conf/HiveConf.java |  2 ++
 .../hive/service/cli/operation/SQLOperation.java       | 13 +++++++++++--
 2 files changed, 13 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hive/blob/2f3b1af4/common/src/java/org/apache/hadoop/hive/conf/HiveConf.java
----------------------------------------------------------------------
diff --git a/common/src/java/org/apache/hadoop/hive/conf/HiveConf.java b/common/src/java/org/apache/hadoop/hive/conf/HiveConf.java
index 4cfa5f1..c0843b9 100644
--- a/common/src/java/org/apache/hadoop/hive/conf/HiveConf.java
+++ b/common/src/java/org/apache/hadoop/hive/conf/HiveConf.java
@@ -2225,6 +2225,8 @@ public class HiveConf extends Configuration {
         new TimeValidator(TimeUnit.SECONDS),
         "Time that an idle HiveServer2 async thread (from the thread pool) will wait for a new task\n" +
         "to arrive before terminating"),
+    HIVE_SERVER2_ASYNC_EXEC_ASYNC_COMPILE("hive.server2.async.exec.async.compile", false,
+        "Whether to enable compiling async query asynchronously. If enabled, it is unknown if the query will have any resultset before compilation completed."),
     HIVE_SERVER2_LONG_POLLING_TIMEOUT("hive.server2.long.polling.timeout", "5000ms",
         new TimeValidator(TimeUnit.MILLISECONDS),
         "Time that HiveServer2 will wait before responding to asynchronous calls that use long polling"),

http://git-wip-us.apache.org/repos/asf/hive/blob/2f3b1af4/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 67e0e52..33f95fb 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
@@ -261,8 +261,14 @@ public class SQLOperation extends ExecuteStatementOperation {
   public void runInternal() throws HiveSQLException {
     setState(OperationState.PENDING);
 
-    prepare(queryState);
-    if (!shouldRunAsync()) {
+    boolean runAsync = shouldRunAsync();
+    final boolean asyncPrepare = runAsync
+      && HiveConf.getBoolVar(queryState.getConf(),
+        HiveConf.ConfVars.HIVE_SERVER2_ASYNC_EXEC_ASYNC_COMPILE);
+    if (!asyncPrepare) {
+      prepare(queryState);
+    }
+    if (!runAsync) {
       runQuery();
     } else {
       // We'll pass ThreadLocals in the background thread from the foreground (handler) thread
@@ -287,6 +293,9 @@ public class SQLOperation extends ExecuteStatementOperation {
               registerCurrentOperationLog();
               registerLoggingContext();
               try {
+                if (asyncPrepare) {
+                  prepare(queryState);
+                }
                 runQuery();
               } catch (HiveSQLException e) {
                 setOperationException(e);