hive-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sze...@apache.org
Subject hive git commit: HIVE-13420 : Clarify HS2 WebUI Query 'Elapsed Time' (Szehon, reviewed by Aihua Xu and Mohit Sabharwal)
Date Sun, 10 Apr 2016 08:08:20 GMT
Repository: hive
Updated Branches:
  refs/heads/master 0ebd4d17b -> 010157e9a


HIVE-13420 : Clarify HS2 WebUI Query 'Elapsed Time' (Szehon, reviewed by Aihua Xu and Mohit
Sabharwal)


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

Branch: refs/heads/master
Commit: 010157e9ab16601b72431ad68efb763ea11c170c
Parents: 0ebd4d1
Author: Szehon Ho <szehon@cloudera.com>
Authored: Sun Apr 10 01:07:44 2016 -0700
Committer: Szehon Ho <szehon@cloudera.com>
Committed: Sun Apr 10 01:07:44 2016 -0700

----------------------------------------------------------------------
 .../service/cli/session/TestQueryDisplay.java   |  2 ++
 .../org/apache/hive/tmpl/QueryProfileTmpl.jamon | 16 ++++++++------
 .../hive/service/cli/operation/Operation.java   |  2 +-
 .../service/cli/operation/SQLOperation.java     |  5 +++++
 .../cli/operation/SQLOperationDisplay.java      |  9 ++++++++
 .../hive-webapps/hiveserver2/hiveserver2.jsp    | 22 ++++++++++++--------
 6 files changed, 40 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hive/blob/010157e9/itests/hive-unit/src/test/java/org/apache/hive/service/cli/session/TestQueryDisplay.java
----------------------------------------------------------------------
diff --git a/itests/hive-unit/src/test/java/org/apache/hive/service/cli/session/TestQueryDisplay.java
b/itests/hive-unit/src/test/java/org/apache/hive/service/cli/session/TestQueryDisplay.java
index 418f71e..98581e0 100644
--- a/itests/hive-unit/src/test/java/org/apache/hive/service/cli/session/TestQueryDisplay.java
+++ b/itests/hive-unit/src/test/java/org/apache/hive/service/cli/session/TestQueryDisplay.java
@@ -133,8 +133,10 @@ public class TestQueryDisplay {
     if (finished) {
       Assert.assertTrue(display.getEndTime() > 0 && display.getEndTime() >=
display.getBeginTime()
         && display.getEndTime() <= System.currentTimeMillis());
+      Assert.assertTrue(display.getRuntime() > 0);
     } else {
       Assert.assertNull(display.getEndTime());
+      //For runtime, query may have finished.
     }
 
     QueryDisplay qDisplay1 = display.getQueryDisplay();

http://git-wip-us.apache.org/repos/asf/hive/blob/010157e9/service/src/jamon/org/apache/hive/tmpl/QueryProfileTmpl.jamon
----------------------------------------------------------------------
diff --git a/service/src/jamon/org/apache/hive/tmpl/QueryProfileTmpl.jamon b/service/src/jamon/org/apache/hive/tmpl/QueryProfileTmpl.jamon
index 8d51a73..690c6f3 100644
--- a/service/src/jamon/org/apache/hive/tmpl/QueryProfileTmpl.jamon
+++ b/service/src/jamon/org/apache/hive/tmpl/QueryProfileTmpl.jamon
@@ -129,7 +129,7 @@ org.apache.hive.service.cli.operation.SQLOperationDisplay;
             <td><% sod.getQueryDisplay() == null ? "Unknown" : sod.getQueryDisplay().getQueryString()
%></td>
         </tr>
         <tr>
-            <td>Query Id</td>
+            <td>Id</td>
             <td><% sod.getQueryDisplay() == null ? "Unknown" : sod.getQueryDisplay().getQueryId()
%></td>
         </tr>
         <tr>
@@ -141,23 +141,27 @@ org.apache.hive.service.cli.operation.SQLOperationDisplay;
             <td><% sod.getState() %></td>
         </tr>
         <tr>
-            <td>Begin Time</td>
+            <td>Opened Timestamp</td>
             <td><% new Date(sod.getBeginTime()) %></td>
         </tr>
         <tr>
-            <td>Elapsed Time (s)</td>
+            <td>Opened (s)</td>
             <td><% sod.getElapsedTime()/1000 %></td>
         </tr>
         <tr>
-            <td>End Time</td>
-            <td><% sod.getEndTime() == null ? "In Progress" : new Date(sod.getEndTime())
%></td>
+            <td>Closed Timestamp</td>
+            <td><% sod.getEndTime() == null ? "Open" : new Date(sod.getEndTime())
%></td>
         </tr>
         <%if sod.getQueryDisplay() != null && sod.getQueryDisplay().getErrorMessage()
!= null %>
             <tr>
                 <td>Error</td>
-                <td><% sod.getEndTime() == null ? "In Progress" : new Date(sod.getEndTime())
%></td>
+                <td><% sod.getQueryDisplay().getErrorMessage() %></td>
             </tr>
         </%if>
+        <tr>
+            <td>Latency (s)</td>
+            <td><% sod.getRuntime()/1000 %></td>
+        </tr>
     </table>
 </%def>
 

http://git-wip-us.apache.org/repos/asf/hive/blob/010157e9/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 d9a273b..b7d6549 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
@@ -446,7 +446,7 @@ public abstract class Operation {
   protected void onNewState(OperationState state, OperationState prevState) {
     switch(state) {
       case RUNNING:
-      markOperationStartTime();
+        markOperationStartTime();
         break;
       case ERROR:
       case FINISHED:

http://git-wip-us.apache.org/repos/asf/hive/blob/010157e9/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 04d816a..9ce6055 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
@@ -556,6 +556,11 @@ public class SQLOperation extends ExecuteStatementOperation {
       }
     }
 
+    if (state == OperationState.FINISHED || state == OperationState.CANCELED || state ==
OperationState.ERROR) {
+      //update runtime
+      sqlOpDisplay.setRuntime(getOperationComplete() - getOperationStart());
+    }
+
     if (state == OperationState.CLOSED) {
       sqlOpDisplay.closed();
     } else {

http://git-wip-us.apache.org/repos/asf/hive/blob/010157e9/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 d2ca1e7..fe93426 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
@@ -32,6 +32,7 @@ public class SQLOperationDisplay {
   public final String executionEngine;
   public final long beginTime;
   public final String operationId;
+  public Long runtime;  //tracks only running portion of the query.
 
   public Long endTime;
   public OperationState state;
@@ -96,4 +97,12 @@ public class SQLOperationDisplay {
   public synchronized void closed() {
     this.endTime = System.currentTimeMillis();
   }
+
+  public synchronized void setRuntime(long runtime) {
+    this.runtime = runtime;
+  }
+
+  public synchronized Long getRuntime() {
+    return runtime;
+  }
 }

http://git-wip-us.apache.org/repos/asf/hive/blob/010157e9/service/src/resources/hive-webapps/hiveserver2/hiveserver2.jsp
----------------------------------------------------------------------
diff --git a/service/src/resources/hive-webapps/hiveserver2/hiveserver2.jsp b/service/src/resources/hive-webapps/hiveserver2/hiveserver2.jsp
index 8b46550..293a8ef 100644
--- a/service/src/resources/hive-webapps/hiveserver2/hiveserver2.jsp
+++ b/service/src/resources/hive-webapps/hiveserver2/hiveserver2.jsp
@@ -125,15 +125,16 @@ for (HiveSession hiveSession: hiveSessions) {
 </section>
 
 <section>
-<h2>Queries</h2>
+<h2>Open Queries</h2>
 <table id="attributes_table" class="table table-striped">
     <tr>
         <th>User Name</th>
         <th>Query</th>
         <th>Execution Engine</th>
         <th>State</th>
-        <th>Begin Time</th>
-        <th>Elapsed Time (s)</th>
+        <th>Opened Timestamp</th>
+        <th>Opened (s)</th>
+        <th>Latency (s)</th>
         <th>Drilldown Link</th>
     </tr>
     <%
@@ -149,30 +150,32 @@ for (HiveSession hiveSession: hiveSessions) {
         <td><%= operation.getState() %></td>
         <td><%= new Date(operation.getBeginTime()) %></td>
         <td><%= operation.getElapsedTime()/1000 %></td>
+        <td><%= operation.getRuntime() == null ? "Not finished" : operation.getRuntime()/1000
%></td>
         <% String link = "/query_page?operationId=" + operation.getOperationId(); %>
-        <td>  <a href= <%= link %>>Query Drilldown</a> </td>
+        <td>  <a href= <%= link %>>Drilldown</a> </td>
     </tr>
 
 <%
   }
 %>
 <tr>
-  <td colspan="7">Total number of queries: <%= queries %></td>
+  <td colspan="8">Total number of queries: <%= queries %></td>
 </tr>
 </table>
 </section>
 
 
 <section>
-<h2>Last Max <%= conf.get(ConfVars.HIVE_SERVER2_WEBUI_MAX_HISTORIC_QUERIES.varname)
%> Completed Queries</h2>
+<h2>Last Max <%= conf.get(ConfVars.HIVE_SERVER2_WEBUI_MAX_HISTORIC_QUERIES.varname)
%> Closed Queries</h2>
 <table id="attributes_table" class="table table-striped">
     <tr>
         <th>User Name</th>
         <th>Query</th>
         <th>Execution Engine</th>
         <th>State</th>
-        <th>Elapsed Time (s)</th>
-        <th>End Time</th>
+        <th>Opened (s)</th>
+        <th>Closed Timestamp</th>
+        <th>Latency (s)</th>
         <th>Drilldown Link</th>
     </tr>
     <%
@@ -188,8 +191,9 @@ for (HiveSession hiveSession: hiveSessions) {
         <td><%= operation.getState() %></td>
         <td><%= operation.getElapsedTime()/1000 %></td>
         <td><%= operation.getEndTime() == null ? "In Progress" : new Date(operation.getEndTime())
%></td>
+        <td><%= operation.getRuntime()/1000 %></td>
         <% String link = "/query_page?operationId=" + operation.getOperationId(); %>
-        <td>  <a href= <%= link %>>Query Drilldown</a> </td>
+        <td>  <a href= <%= link %>>Drilldown</a> </td>
     </tr>
 
 <%


Mime
View raw message