You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@drill.apache.org by vi...@apache.org on 2019/01/18 18:22:51 UTC

[drill] 01/06: DRILL-6971: Display query state in query result page

This is an automated email from the ASF dual-hosted git repository.

vitalii pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/drill.git

commit 4355e979e81ef7353b6e48b19283e0765e9a14bf
Author: Sorabh Hamirwasia <so...@apache.org>
AuthorDate: Fri Jan 11 16:42:21 2019 -0800

    DRILL-6971: Display query state in query result page
---
 .../drill/exec/rpc/AbstractDisposableUserClientConnection.java     | 7 +++++++
 .../java/org/apache/drill/exec/server/rest/QueryResources.java     | 6 ++++++
 .../main/java/org/apache/drill/exec/server/rest/QueryWrapper.java  | 2 ++
 exec/java-exec/src/main/resources/rest/query/result.ftl            | 3 +++
 4 files changed, 18 insertions(+)

diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/AbstractDisposableUserClientConnection.java b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/AbstractDisposableUserClientConnection.java
index 3d5b297..1b8a347 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/AbstractDisposableUserClientConnection.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/AbstractDisposableUserClientConnection.java
@@ -45,6 +45,8 @@ public abstract class AbstractDisposableUserClientConnection implements UserClie
 
   protected volatile UserException exception;
 
+  protected String queryState;
+
   /**
    * Wait until the query has completed or timeout is passed.
    *
@@ -73,6 +75,7 @@ public abstract class AbstractDisposableUserClientConnection implements UserClie
 
     // Release the wait latch if the query is terminated.
     final QueryState state = result.getQueryState();
+    queryState = state.toString();
     final QueryId queryId = result.getQueryId();
 
     if (logger.isDebugEnabled()) {
@@ -104,4 +107,8 @@ public abstract class AbstractDisposableUserClientConnection implements UserClie
   public DrillPBError getError() {
     return error;
   }
+
+  public String getQueryState() {
+    return queryState;
+  }
 }
\ No newline at end of file
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/QueryResources.java b/exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/QueryResources.java
index 61af7c7..e62d33d 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/QueryResources.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/QueryResources.java
@@ -134,6 +134,7 @@ public class QueryResources {
     private final List<List<String>> rows;
     private final String queryId;
     private final String rowsPerPageValues;
+    private final String queryState;
 
     public TabularResult(QueryResult result, String rowsPerPageValuesAsStr) {
       rowsPerPageValues = rowsPerPageValuesAsStr;
@@ -149,6 +150,7 @@ public class QueryResources {
 
       this.columns = ImmutableList.copyOf(result.columns);
       this.rows = rows;
+      this.queryState = result.queryState;
     }
 
     public boolean isEmpty() {
@@ -171,6 +173,10 @@ public class QueryResources {
     public String getRowsPerPageValues() {
       return rowsPerPageValues;
     }
+
+    public String getQueryState() {
+      return queryState;
+    }
   }
 
 }
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/QueryWrapper.java b/exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/QueryWrapper.java
index 4eb1656..9501164 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/QueryWrapper.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/QueryWrapper.java
@@ -128,12 +128,14 @@ public class QueryWrapper {
     public final Collection<String> columns;
     public final List<Map<String, String>> rows;
     public final List<String> metadata;
+    public final String queryState;
 
     //DRILL-6847:  Modified the constructor so that the method has access to all the properties in webUserConnection
     public QueryResult(QueryId queryId, WebUserConnection webUserConnection, List<Map<String, String>> rows) {
         this.queryId = QueryIdHelper.getQueryId(queryId);
         this.columns = webUserConnection.columns;
         this.metadata = webUserConnection.metadata;
+        this.queryState = webUserConnection.getQueryState();
         this.rows = rows;
       }
 
diff --git a/exec/java-exec/src/main/resources/rest/query/result.ftl b/exec/java-exec/src/main/resources/rest/query/result.ftl
index 9f16c1f..13e675d 100644
--- a/exec/java-exec/src/main/resources/rest/query/result.ftl
+++ b/exec/java-exec/src/main/resources/rest/query/result.ftl
@@ -34,6 +34,9 @@
     <td align='left'>
       <button type="button"  title="Open in new window" onclick="popOutProfile('${model.getQueryId()}');" class="btn btn-default btn-sm">
       <b>Query Profile:</b> ${model.getQueryId()} <span class="glyphicon glyphicon-new-window"/></button>
+     </td>
+     <td>
+         <span class="input-group-addon" style="font-size:95%"><b>Query State:</b> ${model.getQueryState()}</span>
      </td><td align="right" width="100%">
        <div class="input-group">
          <span class="input-group-addon" style="font-size:95%">Delimiter </span>