diff options
author | Sorabh Hamirwasia <sorabh@apache.org> | 2019-01-11 16:42:21 -0800 |
---|---|---|
committer | Vitalii Diravka <vitalii.diravka@gmail.com> | 2019-01-18 17:50:18 +0200 |
commit | 4355e979e81ef7353b6e48b19283e0765e9a14bf (patch) | |
tree | 1e8d96c04ae4d6eb719167a72bc64b9404fac180 | |
parent | 172dc7cb4c3323e9650db2bf7fe1eab76c2fbbe1 (diff) |
DRILL-6971: Display query state in query result page
4 files changed, 18 insertions, 0 deletions
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 3d5b29788..1b8a34760 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 61af7c7ac..e62d33d7a 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 4eb165660..95011641f 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 9f16c1f31..13e675d59 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> |