You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@drill.apache.org by ja...@apache.org on 2014/06/11 05:52:05 UTC

[20/61] [abbrv] git commit: Use PStore for profiles, partial profiles on running queries

Use PStore for profiles, partial profiles on running queries

Full profiles through rpc layer


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

Branch: refs/heads/master
Commit: 2dec152b44ba2db5c4bde94e1184131e98a3942b
Parents: 02263ed
Author: Steven Phillips <sp...@maprtech.com>
Authored: Fri May 30 16:21:49 2014 -0700
Committer: Jacques Nadeau <ja...@apache.org>
Committed: Sun Jun 8 19:13:05 2014 -0700

----------------------------------------------------------------------
 .../drill/exec/physical/impl/ScreenCreator.java |    3 +-
 .../impl/materialize/QueryWritableBatch.java    |    3 +-
 .../materialize/VectorRecordMaterializer.java   |    3 +-
 .../exec/rpc/control/ControlRpcConfig.java      |    3 +
 .../drill/exec/rpc/control/ControlTunnel.java   |   22 +
 .../rpc/control/DefaultInstanceHandler.java     |    5 +-
 .../drill/exec/rpc/user/QueryResultBatch.java   |    2 +-
 .../drill/exec/rpc/user/QueryResultHandler.java |    4 +-
 .../apache/drill/exec/rpc/user/UserClient.java  |    2 +-
 .../drill/exec/rpc/user/UserRpcConfig.java      |    2 +-
 .../drill/exec/server/rest/DrillRoot.java       |   55 +-
 .../org/apache/drill/exec/work/WorkManager.java |    5 +
 .../exec/work/batch/ControlHandlerImpl.java     |   20 +
 .../apache/drill/exec/work/foreman/Foreman.java |   28 +-
 .../drill/exec/work/foreman/QueryManager.java   |   36 +-
 .../drill/exec/work/foreman/QueryStatus.java    |  109 +-
 .../apache/drill/exec/work/user/UserWorker.java |    4 +-
 .../src/main/resources/rest/status/error.ftl    |   21 +
 .../src/main/resources/rest/status/list.ftl     |   27 +-
 .../org/apache/drill/exec/proto/BitControl.java |   63 +-
 .../org/apache/drill/exec/proto/ExecProtos.java |  643 +---
 .../drill/exec/proto/SchemaExecProtos.java      |  118 -
 .../drill/exec/proto/SchemaUserBitShared.java   |  343 +-
 .../drill/exec/proto/SchemaUserProtos.java      |  307 --
 .../apache/drill/exec/proto/UserBitShared.java  | 3299 +++++++++++++++++-
 .../org/apache/drill/exec/proto/UserProtos.java | 2645 +-------------
 .../drill/exec/proto/beans/QueryProfile.java    |   96 +-
 protocol/src/main/protobuf/BitControl.proto     |   10 +-
 protocol/src/main/protobuf/User.proto           |   27 -
 protocol/src/main/protobuf/UserBitShared.proto  |   33 +-
 30 files changed, 3987 insertions(+), 3951 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/2dec152b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/ScreenCreator.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/ScreenCreator.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/ScreenCreator.java
index 9aefbe8..643552b 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/ScreenCreator.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/ScreenCreator.java
@@ -27,8 +27,8 @@ import org.apache.drill.exec.physical.impl.materialize.QueryWritableBatch;
 import org.apache.drill.exec.physical.impl.materialize.RecordMaterializer;
 import org.apache.drill.exec.physical.impl.materialize.VectorRecordMaterializer;
 import org.apache.drill.exec.proto.GeneralRPCProtos.Ack;
+import org.apache.drill.exec.proto.UserBitShared.QueryResult;
 import org.apache.drill.exec.proto.UserBitShared.RecordBatchDef;
-import org.apache.drill.exec.proto.UserProtos.QueryResult;
 import org.apache.drill.exec.record.RecordBatch;
 import org.apache.drill.exec.record.RecordBatch.IterOutcome;
 import org.apache.drill.exec.rpc.BaseRpcOutcomeListener;
@@ -70,6 +70,7 @@ public class ScreenCreator implements RootCreator<Screen>{
       this.connection = context.getConnection();
     }
 
+
     @Override
     public boolean next() {
       if(!ok){

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/2dec152b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/materialize/QueryWritableBatch.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/materialize/QueryWritableBatch.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/materialize/QueryWritableBatch.java
index f6550f3..aba7370 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/materialize/QueryWritableBatch.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/materialize/QueryWritableBatch.java
@@ -21,8 +21,7 @@ import java.util.Arrays;
 
 import io.netty.buffer.ByteBuf;
 
-import org.apache.drill.exec.proto.UserProtos.QueryResult;
-import org.apache.drill.exec.record.WritableBatch;
+import org.apache.drill.exec.proto.UserBitShared.QueryResult;
 
 public class QueryWritableBatch {
   static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(QueryWritableBatch.class);

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/2dec152b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/materialize/VectorRecordMaterializer.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/materialize/VectorRecordMaterializer.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/materialize/VectorRecordMaterializer.java
index e884f8a..b4e4871 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/materialize/VectorRecordMaterializer.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/materialize/VectorRecordMaterializer.java
@@ -19,9 +19,8 @@ package org.apache.drill.exec.physical.impl.materialize;
 
 import org.apache.drill.exec.ops.FragmentContext;
 import org.apache.drill.exec.proto.UserBitShared.QueryId;
-import org.apache.drill.exec.proto.UserProtos.QueryResult;
+import org.apache.drill.exec.proto.UserBitShared.QueryResult;
 import org.apache.drill.exec.record.BatchSchema;
-import org.apache.drill.exec.record.MaterializedField;
 import org.apache.drill.exec.record.RecordBatch;
 import org.apache.drill.exec.record.WritableBatch;
 

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/2dec152b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/control/ControlRpcConfig.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/control/ControlRpcConfig.java b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/control/ControlRpcConfig.java
index 53e5d1a..b398e47 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/control/ControlRpcConfig.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/control/ControlRpcConfig.java
@@ -24,6 +24,8 @@ import org.apache.drill.exec.proto.BitControl.PlanFragment;
 import org.apache.drill.exec.proto.BitControl.RpcType;
 import org.apache.drill.exec.proto.ExecProtos.FragmentHandle;
 import org.apache.drill.exec.proto.GeneralRPCProtos.Ack;
+import org.apache.drill.exec.proto.UserBitShared.QueryId;
+import org.apache.drill.exec.proto.UserBitShared.QueryProfile;
 import org.apache.drill.exec.rpc.Acks;
 import org.apache.drill.exec.rpc.Response;
 import org.apache.drill.exec.rpc.RpcConfig;
@@ -36,6 +38,7 @@ public class ControlRpcConfig {
       .add(RpcType.REQ_INIATILIZE_FRAGMENT, PlanFragment.class, RpcType.ACK, Ack.class)
       .add(RpcType.REQ_CANCEL_FRAGMENT, FragmentHandle.class, RpcType.ACK, Ack.class)
       .add(RpcType.REQ_FRAGMENT_STATUS, FragmentStatus.class, RpcType.ACK, Ack.class)
+      .add(RpcType.REQ_QUERY_STATUS, QueryId.class, RpcType.RESP_QUERY_STATUS, QueryProfile.class)
       .build();
   
   public static int RPC_VERSION = 2;

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/2dec152b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/control/ControlTunnel.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/control/ControlTunnel.java b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/control/ControlTunnel.java
index ea680d9..d0f4bde 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/control/ControlTunnel.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/control/ControlTunnel.java
@@ -23,6 +23,8 @@ import org.apache.drill.exec.proto.BitControl.RpcType;
 import org.apache.drill.exec.proto.CoordinationProtos.DrillbitEndpoint;
 import org.apache.drill.exec.proto.ExecProtos.FragmentHandle;
 import org.apache.drill.exec.proto.GeneralRPCProtos.Ack;
+import org.apache.drill.exec.proto.UserBitShared.QueryId;
+import org.apache.drill.exec.proto.UserBitShared.QueryProfile;
 import org.apache.drill.exec.rpc.DrillRpcFuture;
 import org.apache.drill.exec.rpc.FutureBitCommand;
 import org.apache.drill.exec.rpc.ListeningCommand;
@@ -61,6 +63,12 @@ public class ControlTunnel {
     return b.getFuture();
   }
 
+  public DrillRpcFuture<QueryProfile> requestQueryProfile(QueryId queryId) {
+    RequestProfile b = new RequestProfile(queryId);
+    manager.runCommand(b);
+    return b.getFuture();
+  }
+
 
   public static class SendFragmentStatus extends FutureBitCommand<Ack, ControlConnection> {
     final FragmentStatus status;
@@ -107,4 +115,18 @@ public class ControlTunnel {
 
   }
 
+  public static class RequestProfile extends FutureBitCommand<QueryProfile, ControlConnection> {
+    final QueryId queryId;
+
+    public RequestProfile(QueryId queryId) {
+      super();
+      this.queryId = queryId;
+    }
+
+    @Override
+    public void doRpcCall(RpcOutcomeListener<QueryProfile> outcomeListener, ControlConnection connection) {
+      connection.send(outcomeListener, RpcType.REQ_QUERY_STATUS, queryId, QueryProfile.class);
+    }
+  }
+
 }

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/2dec152b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/control/DefaultInstanceHandler.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/control/DefaultInstanceHandler.java b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/control/DefaultInstanceHandler.java
index 415932b..ed0d370 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/control/DefaultInstanceHandler.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/control/DefaultInstanceHandler.java
@@ -23,6 +23,7 @@ import org.apache.drill.exec.proto.BitControl.FragmentStatus;
 import org.apache.drill.exec.proto.BitControl.RpcType;
 import org.apache.drill.exec.proto.ExecProtos.FragmentHandle;
 import org.apache.drill.exec.proto.GeneralRPCProtos.Ack;
+import org.apache.drill.exec.proto.UserBitShared.QueryProfile;
 import org.apache.drill.exec.rpc.RpcException;
 
 import com.google.protobuf.MessageLite;
@@ -43,7 +44,9 @@ public class DefaultInstanceHandler {
       return FragmentStatus.getDefaultInstance();
     case RpcType.RESP_BIT_STATUS_VALUE:
       return BitStatus.getDefaultInstance();
-      
+    case RpcType.RESP_QUERY_STATUS_VALUE:
+      return QueryProfile.getDefaultInstance();
+
     default:
       throw new UnsupportedOperationException();
     }

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/2dec152b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/user/QueryResultBatch.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/user/QueryResultBatch.java b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/user/QueryResultBatch.java
index 7cfbbb8..98e5943 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/user/QueryResultBatch.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/user/QueryResultBatch.java
@@ -19,7 +19,7 @@ package org.apache.drill.exec.rpc.user;
 
 import io.netty.buffer.ByteBuf;
 
-import org.apache.drill.exec.proto.UserProtos.QueryResult;
+import org.apache.drill.exec.proto.UserBitShared.QueryResult;
 
 public class QueryResultBatch {
   static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(QueryResultBatch.class);

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/2dec152b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/user/QueryResultHandler.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/user/QueryResultHandler.java b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/user/QueryResultHandler.java
index 37d8d67..51a1156 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/user/QueryResultHandler.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/user/QueryResultHandler.java
@@ -23,8 +23,8 @@ import java.util.concurrent.ConcurrentLinkedQueue;
 import java.util.concurrent.ConcurrentMap;
 
 import org.apache.drill.exec.proto.UserBitShared.QueryId;
-import org.apache.drill.exec.proto.UserProtos.QueryResult;
-import org.apache.drill.exec.proto.UserProtos.QueryResult.QueryState;
+import org.apache.drill.exec.proto.UserBitShared.QueryResult;
+import org.apache.drill.exec.proto.UserBitShared.QueryResult.QueryState;
 import org.apache.drill.exec.rpc.BaseRpcOutcomeListener;
 import org.apache.drill.exec.rpc.RpcBus;
 import org.apache.drill.exec.rpc.RpcException;

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/2dec152b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/user/UserClient.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/user/UserClient.java b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/user/UserClient.java
index f497d39..31bfd4e 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/user/UserClient.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/user/UserClient.java
@@ -24,8 +24,8 @@ import org.apache.drill.exec.memory.BufferAllocator;
 import org.apache.drill.exec.proto.CoordinationProtos.DrillbitEndpoint;
 import org.apache.drill.exec.proto.GeneralRPCProtos.Ack;
 import org.apache.drill.exec.proto.UserBitShared.QueryId;
+import org.apache.drill.exec.proto.UserBitShared.QueryResult;
 import org.apache.drill.exec.proto.UserProtos.BitToUserHandshake;
-import org.apache.drill.exec.proto.UserProtos.QueryResult;
 import org.apache.drill.exec.proto.UserProtos.RpcType;
 import org.apache.drill.exec.proto.UserProtos.RunQuery;
 import org.apache.drill.exec.proto.UserProtos.UserProperties;

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/2dec152b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/user/UserRpcConfig.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/user/UserRpcConfig.java b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/user/UserRpcConfig.java
index 111afe4..0c04fec 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/user/UserRpcConfig.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/user/UserRpcConfig.java
@@ -19,8 +19,8 @@ package org.apache.drill.exec.rpc.user;
 
 import org.apache.drill.exec.proto.GeneralRPCProtos.Ack;
 import org.apache.drill.exec.proto.UserBitShared.QueryId;
+import org.apache.drill.exec.proto.UserBitShared.QueryResult;
 import org.apache.drill.exec.proto.UserProtos.BitToUserHandshake;
-import org.apache.drill.exec.proto.UserProtos.QueryResult;
 import org.apache.drill.exec.proto.UserProtos.RpcType;
 import org.apache.drill.exec.proto.UserProtos.RunQuery;
 import org.apache.drill.exec.proto.UserProtos.UserToBitHandshake;

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/2dec152b/exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/DrillRoot.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/DrillRoot.java b/exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/DrillRoot.java
index 6008aca..78d196a 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/DrillRoot.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/DrillRoot.java
@@ -17,6 +17,7 @@
  */
 package org.apache.drill.exec.server.rest;
 
+import java.io.IOException;
 import java.text.SimpleDateFormat;
 import java.util.AbstractMap;
 import java.util.Collections;
@@ -43,12 +44,14 @@ import org.apache.drill.exec.client.DrillClient;
 import org.apache.drill.exec.exception.SchemaChangeException;
 import org.apache.drill.exec.proto.UserBitShared;
 import org.apache.drill.exec.proto.UserBitShared.QueryProfile;
+import org.apache.drill.exec.proto.UserBitShared.QueryResult.QueryState;
 import org.apache.drill.exec.record.RecordBatchLoader;
 import org.apache.drill.exec.record.VectorWrapper;
 import org.apache.drill.exec.rpc.RpcException;
 import org.apache.drill.exec.rpc.user.ConnectionThrottle;
 import org.apache.drill.exec.rpc.user.QueryResultBatch;
 import org.apache.drill.exec.rpc.user.UserResultsListener;
+import org.apache.drill.exec.store.sys.PStore;
 import org.apache.drill.exec.vector.ValueVector;
 import org.apache.drill.exec.work.WorkManager;
 import org.apache.drill.exec.work.foreman.QueryStatus;
@@ -80,38 +83,66 @@ public class DrillRoot {
   @GET
   @Path("/queries")
   @Produces(MediaType.TEXT_HTML)
-  public Viewable getResults() {
-    DistributedMap<String, QueryProfile> cprofiles = work.getContext().getCache().getMap(QueryStatus.QUERY_PROFILE);
+  public Viewable getResults() throws IOException {
+    PStore<QueryProfile> profiles = work.getContext().getPersistentStoreProvider().getPStore(QueryStatus.QUERY_PROFILE);
 
-    List<Map.Entry<String, Long>> ids = Lists.newArrayList();
-    for(Map.Entry<String, QueryProfile> entry : cprofiles.getLocalEntries()){
+    List<Map.Entry<String, Long>> runningIds = Lists.newArrayList();
+    List<Map.Entry<String, Long>> finishedIds = Lists.newArrayList();
+    for(Map.Entry<String, QueryProfile> entry : profiles){
       QueryProfile q = entry.getValue();
-      ids.add(new AbstractMap.SimpleEntry<>(entry.getKey(), q.getFragmentProfile(0).getMinorFragmentProfile(0).getStartTime()));
+      if (q.getState() == QueryState.RUNNING || q.getState() == QueryState.PENDING) {
+        runningIds.add(new AbstractMap.SimpleEntry<>(entry.getKey(), q.getStart()));
+      } else {
+        finishedIds.add(new AbstractMap.SimpleEntry<>(entry.getKey(), q.getStart()));
+      }
     }
 
-    Collections.sort(ids, new Comparator<Map.Entry<String, Long>>() {
+    Comparator<Map.Entry<String,Long>> comparator = new Comparator<Map.Entry<String,Long>>() {
       @Override
       public int compare(Map.Entry<String, Long> o1, Map.Entry<String, Long> o2) {
         return o2.getValue().compareTo(o1.getValue());
       }
-    });
+    };
+
+    Collections.sort(runningIds, comparator);
+    Collections.sort(finishedIds, comparator);
 
-    List<Map.Entry<String, String>> queries = Lists.newArrayList();
-    for(Map.Entry<String, Long> entry : ids){
-      queries.add(new AbstractMap.SimpleEntry<>(entry.getKey(), new SimpleDateFormat("MM/dd/yyyy HH:mm:ss").format(new Date(entry.getValue()))));
+    List<Map.Entry<String, String>> runningQueries = Lists.newArrayList();
+    List<Map.Entry<String, String>> oldQueries = Lists.newArrayList();
+    for(Map.Entry<String, Long> entry : runningIds){
+      runningQueries.add(new AbstractMap.SimpleEntry<>(entry.getKey(), new SimpleDateFormat("MM/dd/yyyy HH:mm:ss").format(new Date(entry.getValue()))));
     }
 
+    for(Map.Entry<String, Long> entry : finishedIds){
+      oldQueries.add(new AbstractMap.SimpleEntry<>(entry.getKey(), new SimpleDateFormat("MM/dd/yyyy HH:mm:ss").format(new Date(entry.getValue()))));
+    }
     // add status (running, done)
 
+    Queries queries = new Queries();
+    queries.runningQueries = runningQueries;
+    queries.oldQueries = oldQueries;
+
     return new Viewable("/rest/status/list.ftl", queries);
   }
 
+  public static class Queries {
+    List<Map.Entry<String, String>> runningQueries;
+    List<Map.Entry<String, String>> oldQueries;
+
+    public List<Map.Entry<String, String>> getRunningQueries() {
+      return runningQueries;
+    }
+
+    public List<Map.Entry<String, String>> getOldQueries() {
+      return oldQueries;
+    }
+  }
 
   @GET
   @Path("/query/{queryid}")
   @Produces(MediaType.TEXT_HTML)
-  public Viewable getQuery(@PathParam("queryid") String queryId) {
-    DistributedMap<String, QueryProfile> profiles = work.getContext().getCache().getMap(QueryStatus.QUERY_PROFILE);
+  public Viewable getQuery(@PathParam("queryid") String queryId) throws IOException {
+    PStore<QueryProfile> profiles = work.getContext().getPersistentStoreProvider().getPStore(QueryStatus.QUERY_PROFILE);
     QueryProfile profile = profiles.get(queryId);
     if(profile == null) profile = QueryProfile.getDefaultInstance();
 

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/2dec152b/exec/java-exec/src/main/java/org/apache/drill/exec/work/WorkManager.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/work/WorkManager.java b/exec/java-exec/src/main/java/org/apache/drill/exec/work/WorkManager.java
index 71e4e8e..c037a4c 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/work/WorkManager.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/work/WorkManager.java
@@ -110,6 +110,10 @@ public class WorkManager implements Closeable{
     return userWorker;
   }
 
+  public WorkerBee getBee() {
+    return bee;
+  }
+
   @Override
   public void close() throws IOException {
     try {
@@ -136,6 +140,7 @@ public class WorkManager implements Closeable{
 
     public void addNewForeman(Foreman foreman){
       pendingTasks.add(foreman);
+      queries.put(foreman.getQueryId(), foreman);
     }
 
 

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/2dec152b/exec/java-exec/src/main/java/org/apache/drill/exec/work/batch/ControlHandlerImpl.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/work/batch/ControlHandlerImpl.java b/exec/java-exec/src/main/java/org/apache/drill/exec/work/batch/ControlHandlerImpl.java
index e69bf3a..ee51f3b 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/work/batch/ControlHandlerImpl.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/work/batch/ControlHandlerImpl.java
@@ -35,6 +35,9 @@ import org.apache.drill.exec.proto.BitControl.PlanFragment;
 import org.apache.drill.exec.proto.BitControl.RpcType;
 import org.apache.drill.exec.proto.ExecProtos.FragmentHandle;
 import org.apache.drill.exec.proto.GeneralRPCProtos.Ack;
+import org.apache.drill.exec.proto.UserBitShared.QueryId;
+import org.apache.drill.exec.proto.UserBitShared.QueryProfile;
+import org.apache.drill.exec.proto.helper.QueryIdHelper;
 import org.apache.drill.exec.rpc.Acks;
 import org.apache.drill.exec.rpc.Response;
 import org.apache.drill.exec.rpc.RpcConstants;
@@ -43,6 +46,8 @@ import org.apache.drill.exec.rpc.control.ControlConnection;
 import org.apache.drill.exec.rpc.control.ControlTunnel;
 import org.apache.drill.exec.rpc.data.DataRpcConfig;
 import org.apache.drill.exec.work.WorkManager.WorkerBee;
+import org.apache.drill.exec.work.foreman.Foreman;
+import org.apache.drill.exec.work.foreman.QueryStatus;
 import org.apache.drill.exec.work.fragment.FragmentExecutor;
 import org.apache.drill.exec.work.fragment.FragmentManager;
 import org.apache.drill.exec.work.fragment.NonRootStatusReporter;
@@ -85,6 +90,21 @@ public class ControlHandlerImpl implements ControlMessageHandler {
         return new Response(RpcType.ACK, Acks.FAIL);
       }
 
+    case RpcType.REQ_QUERY_STATUS_VALUE:
+      QueryId queryId = get(pBody, QueryId.PARSER);
+      Foreman foreman = bee.getForemanForQueryId(queryId);
+      QueryProfile profile;
+      if (foreman == null) {
+        try {
+          profile = bee.getContext().getPersistentStoreProvider().getPStore(QueryStatus.QUERY_PROFILE).get(QueryIdHelper.getQueryId(queryId));
+        } catch (IOException e) {
+          throw new RpcException("Failed to get persistent store", e);
+        }
+      } else {
+        profile = bee.getForemanForQueryId(queryId).getQueryStatus().getAsProfile(true);
+      }
+      return new Response(RpcType.RESP_QUERY_STATUS, profile);
+
     default:
       throw new RpcException("Not yet supported.");
     }

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/2dec152b/exec/java-exec/src/main/java/org/apache/drill/exec/work/foreman/Foreman.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/work/foreman/Foreman.java b/exec/java-exec/src/main/java/org/apache/drill/exec/work/foreman/Foreman.java
index b39eaa1..23c325e 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/work/foreman/Foreman.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/work/foreman/Foreman.java
@@ -51,8 +51,8 @@ import org.apache.drill.exec.proto.ExecProtos.FragmentHandle;
 import org.apache.drill.exec.proto.GeneralRPCProtos.Ack;
 import org.apache.drill.exec.proto.UserBitShared.DrillPBError;
 import org.apache.drill.exec.proto.UserBitShared.QueryId;
-import org.apache.drill.exec.proto.UserProtos.QueryResult;
-import org.apache.drill.exec.proto.UserProtos.QueryResult.QueryState;
+import org.apache.drill.exec.proto.UserBitShared.QueryResult;
+import org.apache.drill.exec.proto.UserBitShared.QueryResult.QueryState;
 import org.apache.drill.exec.proto.UserProtos.RequestResults;
 import org.apache.drill.exec.proto.UserProtos.RunQuery;
 import org.apache.drill.exec.proto.helper.QueryIdHelper;
@@ -94,7 +94,7 @@ public class Foreman implements Runnable, Closeable, Comparable<Object>{
     this.queryRequest = queryRequest;
     this.context = new QueryContext(connection.getSession(), queryId, dContext);
     this.initiatingClient = connection;
-    this.fragmentManager = new QueryManager(queryId, queryRequest, bee.getContext().getCache(), new ForemanManagerListener(), dContext.getController());
+    this.fragmentManager = new QueryManager(queryId, queryRequest, bee.getContext().getPersistentStoreProvider(), new ForemanManagerListener(), dContext.getController(), this);
     this.bee = bee;
 
     this.state = new AtomicState<QueryState>(QueryState.PENDING) {
@@ -104,6 +104,10 @@ public class Foreman implements Runnable, Closeable, Comparable<Object>{
     };
   }
 
+  public QueryContext getContext() {
+    return context;
+  }
+
   private boolean isFinished(){
     switch(state.getState()){
     case PENDING:
@@ -119,6 +123,10 @@ public class Foreman implements Runnable, Closeable, Comparable<Object>{
     if(isFinished()){
       logger.error("Received a failure message query finished of: {}", message, t);
     }
+    if (!state.updateState(QueryState.RUNNING, QueryState.FAILED)) {
+      if (!state.updateState(QueryState.PENDING, QueryState.FAILED))
+      logger.warn("Tried to update query state to FAILED, but was not RUNNING");
+    }
     DrillPBError error = ErrorHelper.logAndConvertError(context.getCurrentEndpoint(), message, t, logger);
     QueryResult result = QueryResult //
         .newBuilder() //
@@ -145,6 +153,7 @@ public class Foreman implements Runnable, Closeable, Comparable<Object>{
   void cleanupAndSendResult(QueryResult result){
     bee.retireForeman(this);
     initiatingClient.sendResult(new ResponseSendListener(), new QueryWritableBatch(result));
+    state.updateState(QueryState.RUNNING, QueryState.COMPLETED);
   }
 
   private class ResponseSendListener extends BaseRpcOutcomeListener<Ack> {
@@ -163,6 +172,7 @@ public class Foreman implements Runnable, Closeable, Comparable<Object>{
 
     final String originalThread = Thread.currentThread().getName();
     Thread.currentThread().setName(QueryIdHelper.getQueryId(queryId) + ":foreman");
+    fragmentManager.getStatus().setStartTime(System.currentTimeMillis());
     // convert a run query request into action
     try{
       switch (queryRequest.getType()) {
@@ -310,6 +320,11 @@ public class Foreman implements Runnable, Closeable, Comparable<Object>{
       fragmentManager.runFragments(bee, work.getRootFragment(), work.getRootOperator(), initiatingClient, leafFragments, intermediateFragments);
       logger.debug("Fragments running.");
 
+      state.updateState(QueryState.PENDING, QueryState.RUNNING);
+      int totalFragments = 1 + intermediateFragments.size() + leafFragments.size();
+      fragmentManager.getStatus().setTotalFragments(totalFragments);
+      fragmentManager.getStatus().updateCache();
+
     } catch (ExecutionSetupException | RpcException e) {
       fail("Failure while setting up query.", e);
     }
@@ -346,10 +361,15 @@ public class Foreman implements Runnable, Closeable, Comparable<Object>{
   public void close() throws IOException {
   }
 
-  QueryState getQueryState(){
+  public QueryState getQueryState(){
     return this.state.getState();
   }
 
+  public QueryStatus getQueryStatus() {
+    return this.fragmentManager.getStatus();
+  }
+
+
   class ForemanManagerListener{
     void fail(String message, Throwable t) {
       ForemanManagerListener.this.fail(message, t);

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/2dec152b/exec/java-exec/src/main/java/org/apache/drill/exec/work/foreman/QueryManager.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/work/foreman/QueryManager.java b/exec/java-exec/src/main/java/org/apache/drill/exec/work/foreman/QueryManager.java
index 586b221..faa5578 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/work/foreman/QueryManager.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/work/foreman/QueryManager.java
@@ -32,14 +32,15 @@ import org.apache.drill.exec.proto.CoordinationProtos.DrillbitEndpoint;
 import org.apache.drill.exec.proto.ExecProtos.FragmentHandle;
 import org.apache.drill.exec.proto.GeneralRPCProtos.Ack;
 import org.apache.drill.exec.proto.UserBitShared.QueryId;
-import org.apache.drill.exec.proto.UserProtos.QueryResult;
-import org.apache.drill.exec.proto.UserProtos.QueryResult.QueryState;
+import org.apache.drill.exec.proto.UserBitShared.QueryResult;
+import org.apache.drill.exec.proto.UserBitShared.QueryResult.QueryState;
 import org.apache.drill.exec.proto.UserProtos.RunQuery;
 import org.apache.drill.exec.rpc.RpcException;
 import org.apache.drill.exec.rpc.RpcOutcomeListener;
 import org.apache.drill.exec.rpc.control.Controller;
 import org.apache.drill.exec.rpc.control.WorkEventBus;
 import org.apache.drill.exec.rpc.user.UserServer.UserClientConnection;
+import org.apache.drill.exec.store.sys.PStoreProvider;
 import org.apache.drill.exec.work.EndpointListener;
 import org.apache.drill.exec.work.WorkManager.WorkerBee;
 import org.apache.drill.exec.work.batch.IncomingBuffers;
@@ -56,21 +57,21 @@ public class QueryManager implements FragmentStatusListener{
 
   private final QueryStatus status;
   private final Controller controller;
-  private ForemanManagerListener foreman;
+  private ForemanManagerListener foremanManagerListener;
   private AtomicInteger remainingFragmentCount;
   private WorkEventBus workBus;
   private QueryId queryId;
   private FragmentExecutor rootRunner;
   private RunQuery query;
 
-  public QueryManager(QueryId id, RunQuery query, DistributedCache cache, ForemanManagerListener foreman, Controller controller) {
+  public QueryManager(QueryId id, RunQuery query, PStoreProvider pStoreProvider, ForemanManagerListener foremanManagerListener, Controller controller, Foreman foreman) {
     super();
-    this.foreman = foreman;
+    this.foremanManagerListener = foremanManagerListener;
     this.query = query;
     this.queryId =  id;
     this.controller = controller;
     this.remainingFragmentCount = new AtomicInteger(0);
-    this.status = new QueryStatus(query, id, cache);
+    this.status = new QueryStatus(query, id, pStoreProvider, foreman);
   }
 
   public QueryStatus getStatus(){
@@ -81,7 +82,9 @@ public class QueryManager implements FragmentStatusListener{
 
   }
 
-  public void runFragments(WorkerBee bee, PlanFragment rootFragment, FragmentRoot rootOperator, UserClientConnection rootClient, List<PlanFragment> leafFragments, List<PlanFragment> intermediateFragments) throws ExecutionSetupException{
+  public void runFragments(WorkerBee bee, PlanFragment rootFragment, FragmentRoot rootOperator,
+                           UserClientConnection rootClient, List<PlanFragment> leafFragments,
+                           List<PlanFragment> intermediateFragments) throws ExecutionSetupException{
     logger.debug("Setting up fragment runs.");
     remainingFragmentCount.set(leafFragments.size()+1);
     assert queryId == rootFragment.getHandle().getQueryId();
@@ -139,7 +142,7 @@ public class QueryManager implements FragmentStatusListener{
     logger.debug("New fragment status was provided to Foreman of {}", status);
     switch(status.getProfile().getState()){
     case AWAITING_ALLOCATION:
-      updateStatus(status);
+      updateStatus(status, true);
       break;
     case CANCELLED:
       // we don't care about cancellation messages since we're the only entity that should drive cancellations.
@@ -151,19 +154,18 @@ public class QueryManager implements FragmentStatusListener{
       finished(status);
       break;
     case RUNNING:
-      updateStatus(status);
+      updateStatus(status, false);
       break;
     default:
       throw new UnsupportedOperationException(String.format("Received status of %s", status));
     }
   }
 
-  private void updateStatus(FragmentStatus status){
-    this.status.update(status);
+  private void updateStatus(FragmentStatus status, boolean updateCache){
+    this.status.update(status, updateCache);
   }
 
   private void finished(FragmentStatus status){
-    updateStatus(status);
     int remaining = remainingFragmentCount.decrementAndGet();
     if(remaining == 0){
       logger.info("Outcome status: {}", this.status);
@@ -171,15 +173,19 @@ public class QueryManager implements FragmentStatusListener{
               .setQueryState(QueryState.COMPLETED) //
               .setQueryId(queryId) //
               .build();
-      foreman.cleanupAndSendResult(result);
+      foremanManagerListener.cleanupAndSendResult(result);
     }
+    this.status.setEndTime(System.currentTimeMillis());
+    this.status.incrementFinishedFragments();
+    updateStatus(status, true);
   }
 
   private void fail(FragmentStatus status){
-    updateStatus(status);
     stopQuery();
     QueryResult result = QueryResult.newBuilder().setQueryId(queryId).setQueryState(QueryState.FAILED).addError(status.getProfile().getError()).build();
-    foreman.cleanupAndSendResult(result);
+    foremanManagerListener.cleanupAndSendResult(result);
+    this.status.setEndTime(System.currentTimeMillis());
+    updateStatus(status, true);
   }
 
 

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/2dec152b/exec/java-exec/src/main/java/org/apache/drill/exec/work/foreman/QueryStatus.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/work/foreman/QueryStatus.java b/exec/java-exec/src/main/java/org/apache/drill/exec/work/foreman/QueryStatus.java
index b464aca..70de958 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/work/foreman/QueryStatus.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/work/foreman/QueryStatus.java
@@ -17,43 +17,60 @@
  */
 package org.apache.drill.exec.work.foreman;
 
+import org.apache.drill.common.exceptions.DrillRuntimeException;
 import org.apache.drill.exec.cache.DistributedCache;
 import org.apache.drill.exec.cache.DistributedCache.CacheConfig;
 import org.apache.drill.exec.cache.DistributedCache.SerializationMode;
 import org.apache.drill.exec.cache.DistributedMap;
 import org.apache.drill.exec.proto.BitControl.FragmentStatus;
+import org.apache.drill.exec.proto.SchemaUserBitShared;
 import org.apache.drill.exec.proto.UserBitShared.MajorFragmentProfile;
 import org.apache.drill.exec.proto.UserBitShared.QueryId;
 import org.apache.drill.exec.proto.UserBitShared.QueryProfile;
+import org.apache.drill.exec.proto.UserBitShared.QueryResult.QueryState;
 import org.apache.drill.exec.proto.UserProtos.RunQuery;
 import org.apache.drill.exec.proto.helper.QueryIdHelper;
 
 import com.carrotsearch.hppc.IntObjectOpenHashMap;
+import org.apache.drill.exec.store.sys.PStore;
+import org.apache.drill.exec.store.sys.PStoreConfig;
+import org.apache.drill.exec.store.sys.PStoreProvider;
+import org.apache.drill.exec.work.foreman.Foreman.ForemanManagerListener;
+
+import java.io.IOException;
 
 public class QueryStatus {
   static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(QueryStatus.class);
 
-  public static final CacheConfig<String, QueryProfile> QUERY_PROFILE = CacheConfig //
-      .newBuilder(QueryProfile.class) //
-      .name("sys.queries") //
-      .mode(SerializationMode.PROTOBUF) //
-      .build();
+  public static final PStoreConfig<QueryProfile> QUERY_PROFILE = PStoreConfig.
+          newProtoBuilder(SchemaUserBitShared.QueryProfile.WRITE, SchemaUserBitShared.QueryProfile.MERGE).name("query_profiles").build();
+
 
-  // doesn't need to be thread safe as map is generated in a single thread and then accessed by multiple threads for reads only.
-  private IntObjectOpenHashMap<IntObjectOpenHashMap<FragmentData>> map = new IntObjectOpenHashMap<IntObjectOpenHashMap<FragmentData>>();
+  // doesn't need to be thread safe as fragmentDataMap is generated in a single thread and then accessed by multiple threads for reads only.
+  private IntObjectOpenHashMap<IntObjectOpenHashMap<FragmentData>> fragmentDataMap = new IntObjectOpenHashMap<IntObjectOpenHashMap<FragmentData>>();
 
   private final String queryId;
   private final QueryId id;
   private RunQuery query;
   private String planText;
+  private Foreman foreman;
+  private long startTime;
+  private long endTime;
+  private int totalFragments;
+  private int finishedFragments = 0;
 
-  private final DistributedMap<String, QueryProfile> profileCache;
+  private final PStore<QueryProfile> profileCache;
 
-  public QueryStatus(RunQuery query, QueryId id, DistributedCache cache){
+  public QueryStatus(RunQuery query, QueryId id, PStoreProvider provider, Foreman foreman){
     this.id = id;
     this.query = query;
     this.queryId = QueryIdHelper.getQueryId(id);
-    this.profileCache = cache.getMap(QUERY_PROFILE);
+    try {
+      this.profileCache = provider.getPStore(QUERY_PROFILE);
+    } catch (IOException e) {
+      throw new DrillRuntimeException(e);
+    }
+    this.foreman = foreman;
   }
 
   public void setPlanText(String planText){
@@ -61,31 +78,53 @@ public class QueryStatus {
     updateCache();
 
   }
+
+  public void setStartTime(long startTime) {
+    this.startTime = startTime;
+  }
+
+  public void setEndTime(long endTime) {
+    this.endTime = endTime;
+  }
+
+  public void setTotalFragments(int totalFragments) {
+    this.totalFragments = totalFragments;
+  }
+
+  public void incrementFinishedFragments() {
+    finishedFragments++;
+    assert finishedFragments <= totalFragments;
+  }
+
   void add(FragmentData data){
     int majorFragmentId = data.getHandle().getMajorFragmentId();
     int minorFragmentId = data.getHandle().getMinorFragmentId();
-    IntObjectOpenHashMap<FragmentData> minorMap = map.get(majorFragmentId);
+    IntObjectOpenHashMap<FragmentData> minorMap = fragmentDataMap.get(majorFragmentId);
     if(minorMap == null){
       minorMap = new IntObjectOpenHashMap<FragmentData>();
-      map.put(majorFragmentId, minorMap);
+      fragmentDataMap.put(majorFragmentId, minorMap);
     }
 
     minorMap.put(minorFragmentId, data);
   }
 
-  void update(FragmentStatus status){
+  void update(FragmentStatus status, boolean updateCache){
     int majorFragmentId = status.getHandle().getMajorFragmentId();
     int minorFragmentId = status.getHandle().getMinorFragmentId();
-    map.get(majorFragmentId).get(minorFragmentId).setStatus(status);
-    updateCache();
+    fragmentDataMap.get(majorFragmentId).get(minorFragmentId).setStatus(status);
+    if (updateCache) {
+      updateCache();
+    }
   }
 
-  private void updateCache(){
-    profileCache.put(queryId, getAsProfile());
+  public void updateCache(){
+    QueryState queryState = foreman.getQueryState();
+    boolean fullStatus = queryState == QueryState.COMPLETED || queryState == QueryState.FAILED;
+    profileCache.put(queryId, getAsProfile(fullStatus));
   }
 
   public String toString(){
-    return map.toString();
+    return fragmentDataMap.toString();
   }
 
   public static class FragmentId{
@@ -138,29 +177,37 @@ public class QueryStatus {
     }
   }
 
-  public QueryProfile getAsProfile(){
+  public QueryProfile getAsProfile(boolean fullStatus){
     QueryProfile.Builder b = QueryProfile.newBuilder();
     b.setQuery(query.getPlan());
     b.setType(query.getType());
     if(planText != null) b.setPlan(planText);
     b.setId(id);
-    for(int i = 0; i < map.allocated.length; i++){
-      if(map.allocated[i]){
-        int majorFragmentId = map.keys[i];
-        IntObjectOpenHashMap<FragmentData> minorMap = (IntObjectOpenHashMap<FragmentData>) ((Object[]) map.values)[i];
-
-        MajorFragmentProfile.Builder fb = MajorFragmentProfile.newBuilder();
-        fb.setMajorFragmentId(majorFragmentId);
-        for(int v = 0; v < minorMap.allocated.length; v++){
-          if(minorMap.allocated[v]){
-            FragmentData data = (FragmentData) ((Object[]) minorMap.values)[v];
-            fb.addMinorFragmentProfile(data.getStatus().getProfile());
+    if (fullStatus) {
+      for(int i = 0; i < fragmentDataMap.allocated.length; i++){
+        if(fragmentDataMap.allocated[i]){
+          int majorFragmentId = fragmentDataMap.keys[i];
+          IntObjectOpenHashMap<FragmentData> minorMap = (IntObjectOpenHashMap<FragmentData>) ((Object[]) fragmentDataMap.values)[i];
+
+          MajorFragmentProfile.Builder fb = MajorFragmentProfile.newBuilder();
+          fb.setMajorFragmentId(majorFragmentId);
+          for(int v = 0; v < minorMap.allocated.length; v++){
+            if(minorMap.allocated[v]){
+              FragmentData data = (FragmentData) ((Object[]) minorMap.values)[v];
+              fb.addMinorFragmentProfile(data.getStatus().getProfile());
+            }
           }
+          b.addFragmentProfile(fb);
         }
-        b.addFragmentProfile(fb);
       }
     }
 
+    b.setState(foreman.getQueryState());
+    b.setForeman(foreman.getContext().getCurrentEndpoint());
+    b.setStart(startTime);
+    b.setEnd(endTime);
+    b.setTotalFragments(totalFragments);
+    b.setFinishedFragments(finishedFragments);
     return b.build();
   }
 }

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/2dec152b/exec/java-exec/src/main/java/org/apache/drill/exec/work/user/UserWorker.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/work/user/UserWorker.java b/exec/java-exec/src/main/java/org/apache/drill/exec/work/user/UserWorker.java
index 4f5e2e0..195a2cd 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/work/user/UserWorker.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/work/user/UserWorker.java
@@ -22,8 +22,8 @@ import java.util.UUID;
 import org.apache.drill.exec.proto.ExecProtos.FragmentHandle;
 import org.apache.drill.exec.proto.GeneralRPCProtos.Ack;
 import org.apache.drill.exec.proto.UserBitShared.QueryId;
-import org.apache.drill.exec.proto.UserProtos.QueryResult;
-import org.apache.drill.exec.proto.UserProtos.QueryResult.QueryState;
+import org.apache.drill.exec.proto.UserBitShared.QueryResult;
+import org.apache.drill.exec.proto.UserBitShared.QueryResult.QueryState;
 import org.apache.drill.exec.proto.UserProtos.RequestResults;
 import org.apache.drill.exec.proto.UserProtos.RunQuery;
 import org.apache.drill.exec.rpc.Acks;

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/2dec152b/exec/java-exec/src/main/resources/rest/status/error.ftl
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/resources/rest/status/error.ftl b/exec/java-exec/src/main/resources/rest/status/error.ftl
new file mode 100644
index 0000000..a07794a
--- /dev/null
+++ b/exec/java-exec/src/main/resources/rest/status/error.ftl
@@ -0,0 +1,21 @@
+<#-- Licensed to the Apache Software Foundation (ASF) under one or more contributor
+  license agreements. See the NOTICE file distributed with this work for additional
+  information regarding copyright ownership. The ASF licenses this file to
+  You under the Apache License, Version 2.0 (the "License"); you may not use
+  this file except in compliance with the License. You may obtain a copy of
+  the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required
+  by applicable law or agreed to in writing, software distributed under the
+  License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
+  OF ANY KIND, either express or implied. See the License for the specific
+  language governing permissions and limitations under the License. -->
+
+<html>
+<a href="/queries">back</a><br />
+
+<pre>
+${model.printStackTrace()}
+</pre>
+
+
+
+<html>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/2dec152b/exec/java-exec/src/main/resources/rest/status/list.ftl
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/resources/rest/status/list.ftl b/exec/java-exec/src/main/resources/rest/status/list.ftl
index f40ca32..613a0e9 100644
--- a/exec/java-exec/src/main/resources/rest/status/list.ftl
+++ b/exec/java-exec/src/main/resources/rest/status/list.ftl
@@ -17,7 +17,7 @@
   <a href="/queries">back</a><br/>
   <div class="page-header">
   </div>
-  <h3>List of Queries</h3>
+  <h3>Running Queries</h3>
   <div class="table-responsive">
     <table class="table table-hover">
       <thead>
@@ -25,7 +25,30 @@
          <td>Query</td>
       </thead>
       <tbody>
-        <#list model as query>
+        <#list model.getRunningQueries() as query>
+        <tr>
+          <td>${query.getValue()}</td>
+          <td>
+            <a href="/query/${query.getKey()}">
+              <div style="height:100%;width:100%">
+                ${query.getKey()}
+              </div>
+            </a>
+          </td>
+        </tr>
+        </#list>
+      </tbody>
+    </table>
+  </div>
+  <h3>Completed Queries</h3>
+  <div class="table-responsive">
+    <table class="table table-hover">
+      <thead>
+         <td>Time</td>
+         <td>Query</td>
+      </thead>
+      <tbody>
+        <#list model.getOldQueries() as query>
         <tr>
           <td>${query.getValue()}</td>
           <td>

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/2dec152b/protocol/src/main/java/org/apache/drill/exec/proto/BitControl.java
----------------------------------------------------------------------
diff --git a/protocol/src/main/java/org/apache/drill/exec/proto/BitControl.java b/protocol/src/main/java/org/apache/drill/exec/proto/BitControl.java
index 3efa265..0bf650b 100644
--- a/protocol/src/main/java/org/apache/drill/exec/proto/BitControl.java
+++ b/protocol/src/main/java/org/apache/drill/exec/proto/BitControl.java
@@ -66,7 +66,7 @@ public final class BitControl {
      * <code>REQ_FRAGMENT_STATUS = 7;</code>
      *
      * <pre>
-     * get a fragment status, returns FragmentStatus
+     * send a fragment status, return Ack
      * </pre>
      */
     REQ_FRAGMENT_STATUS(5, 7),
@@ -79,21 +79,29 @@ public final class BitControl {
      */
     REQ_BIT_STATUS(6, 8),
     /**
-     * <code>RESP_FRAGMENT_HANDLE = 9;</code>
+     * <code>REQ_QUERY_STATUS = 9;</code>
+     */
+    REQ_QUERY_STATUS(7, 9),
+    /**
+     * <code>RESP_FRAGMENT_HANDLE = 10;</code>
      *
      * <pre>
      * bit responses
      * </pre>
      */
-    RESP_FRAGMENT_HANDLE(7, 9),
+    RESP_FRAGMENT_HANDLE(8, 10),
+    /**
+     * <code>RESP_FRAGMENT_STATUS = 11;</code>
+     */
+    RESP_FRAGMENT_STATUS(9, 11),
     /**
-     * <code>RESP_FRAGMENT_STATUS = 10;</code>
+     * <code>RESP_BIT_STATUS = 12;</code>
      */
-    RESP_FRAGMENT_STATUS(8, 10),
+    RESP_BIT_STATUS(10, 12),
     /**
-     * <code>RESP_BIT_STATUS = 11;</code>
+     * <code>RESP_QUERY_STATUS = 13;</code>
      */
-    RESP_BIT_STATUS(9, 11),
+    RESP_QUERY_STATUS(11, 13),
     ;
 
     /**
@@ -128,7 +136,7 @@ public final class BitControl {
      * <code>REQ_FRAGMENT_STATUS = 7;</code>
      *
      * <pre>
-     * get a fragment status, returns FragmentStatus
+     * send a fragment status, return Ack
      * </pre>
      */
     public static final int REQ_FRAGMENT_STATUS_VALUE = 7;
@@ -141,21 +149,29 @@ public final class BitControl {
      */
     public static final int REQ_BIT_STATUS_VALUE = 8;
     /**
-     * <code>RESP_FRAGMENT_HANDLE = 9;</code>
+     * <code>REQ_QUERY_STATUS = 9;</code>
+     */
+    public static final int REQ_QUERY_STATUS_VALUE = 9;
+    /**
+     * <code>RESP_FRAGMENT_HANDLE = 10;</code>
      *
      * <pre>
      * bit responses
      * </pre>
      */
-    public static final int RESP_FRAGMENT_HANDLE_VALUE = 9;
+    public static final int RESP_FRAGMENT_HANDLE_VALUE = 10;
+    /**
+     * <code>RESP_FRAGMENT_STATUS = 11;</code>
+     */
+    public static final int RESP_FRAGMENT_STATUS_VALUE = 11;
     /**
-     * <code>RESP_FRAGMENT_STATUS = 10;</code>
+     * <code>RESP_BIT_STATUS = 12;</code>
      */
-    public static final int RESP_FRAGMENT_STATUS_VALUE = 10;
+    public static final int RESP_BIT_STATUS_VALUE = 12;
     /**
-     * <code>RESP_BIT_STATUS = 11;</code>
+     * <code>RESP_QUERY_STATUS = 13;</code>
      */
-    public static final int RESP_BIT_STATUS_VALUE = 11;
+    public static final int RESP_QUERY_STATUS_VALUE = 13;
 
 
     public final int getNumber() { return value; }
@@ -169,9 +185,11 @@ public final class BitControl {
         case 6: return REQ_CANCEL_FRAGMENT;
         case 7: return REQ_FRAGMENT_STATUS;
         case 8: return REQ_BIT_STATUS;
-        case 9: return RESP_FRAGMENT_HANDLE;
-        case 10: return RESP_FRAGMENT_STATUS;
-        case 11: return RESP_BIT_STATUS;
+        case 9: return REQ_QUERY_STATUS;
+        case 10: return RESP_FRAGMENT_HANDLE;
+        case 11: return RESP_FRAGMENT_STATUS;
+        case 12: return RESP_BIT_STATUS;
+        case 13: return RESP_QUERY_STATUS;
         default: return null;
       }
     }
@@ -5221,14 +5239,15 @@ public final class BitControl {
       "e_zone\030\020 \001(\005\022\024\n\014options_json\030\021 \001(\t\"f\n\017Wo" +
       "rkQueueStatus\022(\n\010endpoint\030\001 \001(\0132\026.exec.D" +
       "rillbitEndpoint\022\024\n\014queue_length\030\002 \001(\005\022\023\n" +
-      "\013report_time\030\003 \001(\003*\332\001\n\007RpcType\022\r\n\tHANDSH" +
+      "\013report_time\030\003 \001(\003*\207\002\n\007RpcType\022\r\n\tHANDSH" +
       "AKE\020\000\022\007\n\003ACK\020\001\022\013\n\007GOODBYE\020\002\022\033\n\027REQ_INIAT" +
       "ILIZE_FRAGMENT\020\003\022\027\n\023REQ_CANCEL_FRAGMENT\020" +
       "\006\022\027\n\023REQ_FRAGMENT_STATUS\020\007\022\022\n\016REQ_BIT_ST" +
-      "ATUS\020\010\022\030\n\024RESP_FRAGMENT_HANDLE\020\t\022\030\n\024RESP" +
-      "_FRAGMENT_STATUS\020\n\022\023\n\017RESP_BIT_STATUS\020\013B",
-      "+\n\033org.apache.drill.exec.protoB\nBitContr" +
-      "olH\001"
+      "ATUS\020\010\022\024\n\020REQ_QUERY_STATUS\020\t\022\030\n\024RESP_FRA" +
+      "GMENT_HANDLE\020\n\022\030\n\024RESP_FRAGMENT_STATUS\020\013",
+      "\022\023\n\017RESP_BIT_STATUS\020\014\022\025\n\021RESP_QUERY_STAT" +
+      "US\020\rB+\n\033org.apache.drill.exec.protoB\nBit" +
+      "ControlH\001"
     };
     com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
       new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() {

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/2dec152b/protocol/src/main/java/org/apache/drill/exec/proto/ExecProtos.java
----------------------------------------------------------------------
diff --git a/protocol/src/main/java/org/apache/drill/exec/proto/ExecProtos.java b/protocol/src/main/java/org/apache/drill/exec/proto/ExecProtos.java
index 0572338..7ca17f1 100644
--- a/protocol/src/main/java/org/apache/drill/exec/proto/ExecProtos.java
+++ b/protocol/src/main/java/org/apache/drill/exec/proto/ExecProtos.java
@@ -694,643 +694,11 @@ public final class ExecProtos {
     // @@protoc_insertion_point(class_scope:exec.bit.FragmentHandle)
   }
 
-  public interface ViewPointerOrBuilder
-      extends com.google.protobuf.MessageOrBuilder {
-
-    // optional string name = 1;
-    /**
-     * <code>optional string name = 1;</code>
-     */
-    boolean hasName();
-    /**
-     * <code>optional string name = 1;</code>
-     */
-    java.lang.String getName();
-    /**
-     * <code>optional string name = 1;</code>
-     */
-    com.google.protobuf.ByteString
-        getNameBytes();
-
-    // optional string path = 2;
-    /**
-     * <code>optional string path = 2;</code>
-     */
-    boolean hasPath();
-    /**
-     * <code>optional string path = 2;</code>
-     */
-    java.lang.String getPath();
-    /**
-     * <code>optional string path = 2;</code>
-     */
-    com.google.protobuf.ByteString
-        getPathBytes();
-  }
-  /**
-   * Protobuf type {@code exec.bit.ViewPointer}
-   */
-  public static final class ViewPointer extends
-      com.google.protobuf.GeneratedMessage
-      implements ViewPointerOrBuilder {
-    // Use ViewPointer.newBuilder() to construct.
-    private ViewPointer(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
-      super(builder);
-      this.unknownFields = builder.getUnknownFields();
-    }
-    private ViewPointer(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
-
-    private static final ViewPointer defaultInstance;
-    public static ViewPointer getDefaultInstance() {
-      return defaultInstance;
-    }
-
-    public ViewPointer getDefaultInstanceForType() {
-      return defaultInstance;
-    }
-
-    private final com.google.protobuf.UnknownFieldSet unknownFields;
-    @java.lang.Override
-    public final com.google.protobuf.UnknownFieldSet
-        getUnknownFields() {
-      return this.unknownFields;
-    }
-    private ViewPointer(
-        com.google.protobuf.CodedInputStream input,
-        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-        throws com.google.protobuf.InvalidProtocolBufferException {
-      initFields();
-      int mutable_bitField0_ = 0;
-      com.google.protobuf.UnknownFieldSet.Builder unknownFields =
-          com.google.protobuf.UnknownFieldSet.newBuilder();
-      try {
-        boolean done = false;
-        while (!done) {
-          int tag = input.readTag();
-          switch (tag) {
-            case 0:
-              done = true;
-              break;
-            default: {
-              if (!parseUnknownField(input, unknownFields,
-                                     extensionRegistry, tag)) {
-                done = true;
-              }
-              break;
-            }
-            case 10: {
-              bitField0_ |= 0x00000001;
-              name_ = input.readBytes();
-              break;
-            }
-            case 18: {
-              bitField0_ |= 0x00000002;
-              path_ = input.readBytes();
-              break;
-            }
-          }
-        }
-      } catch (com.google.protobuf.InvalidProtocolBufferException e) {
-        throw e.setUnfinishedMessage(this);
-      } catch (java.io.IOException e) {
-        throw new com.google.protobuf.InvalidProtocolBufferException(
-            e.getMessage()).setUnfinishedMessage(this);
-      } finally {
-        this.unknownFields = unknownFields.build();
-        makeExtensionsImmutable();
-      }
-    }
-    public static final com.google.protobuf.Descriptors.Descriptor
-        getDescriptor() {
-      return org.apache.drill.exec.proto.ExecProtos.internal_static_exec_bit_ViewPointer_descriptor;
-    }
-
-    protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
-        internalGetFieldAccessorTable() {
-      return org.apache.drill.exec.proto.ExecProtos.internal_static_exec_bit_ViewPointer_fieldAccessorTable
-          .ensureFieldAccessorsInitialized(
-              org.apache.drill.exec.proto.ExecProtos.ViewPointer.class, org.apache.drill.exec.proto.ExecProtos.ViewPointer.Builder.class);
-    }
-
-    public static com.google.protobuf.Parser<ViewPointer> PARSER =
-        new com.google.protobuf.AbstractParser<ViewPointer>() {
-      public ViewPointer parsePartialFrom(
-          com.google.protobuf.CodedInputStream input,
-          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-          throws com.google.protobuf.InvalidProtocolBufferException {
-        return new ViewPointer(input, extensionRegistry);
-      }
-    };
-
-    @java.lang.Override
-    public com.google.protobuf.Parser<ViewPointer> getParserForType() {
-      return PARSER;
-    }
-
-    private int bitField0_;
-    // optional string name = 1;
-    public static final int NAME_FIELD_NUMBER = 1;
-    private java.lang.Object name_;
-    /**
-     * <code>optional string name = 1;</code>
-     */
-    public boolean hasName() {
-      return ((bitField0_ & 0x00000001) == 0x00000001);
-    }
-    /**
-     * <code>optional string name = 1;</code>
-     */
-    public java.lang.String getName() {
-      java.lang.Object ref = name_;
-      if (ref instanceof java.lang.String) {
-        return (java.lang.String) ref;
-      } else {
-        com.google.protobuf.ByteString bs = 
-            (com.google.protobuf.ByteString) ref;
-        java.lang.String s = bs.toStringUtf8();
-        if (bs.isValidUtf8()) {
-          name_ = s;
-        }
-        return s;
-      }
-    }
-    /**
-     * <code>optional string name = 1;</code>
-     */
-    public com.google.protobuf.ByteString
-        getNameBytes() {
-      java.lang.Object ref = name_;
-      if (ref instanceof java.lang.String) {
-        com.google.protobuf.ByteString b = 
-            com.google.protobuf.ByteString.copyFromUtf8(
-                (java.lang.String) ref);
-        name_ = b;
-        return b;
-      } else {
-        return (com.google.protobuf.ByteString) ref;
-      }
-    }
-
-    // optional string path = 2;
-    public static final int PATH_FIELD_NUMBER = 2;
-    private java.lang.Object path_;
-    /**
-     * <code>optional string path = 2;</code>
-     */
-    public boolean hasPath() {
-      return ((bitField0_ & 0x00000002) == 0x00000002);
-    }
-    /**
-     * <code>optional string path = 2;</code>
-     */
-    public java.lang.String getPath() {
-      java.lang.Object ref = path_;
-      if (ref instanceof java.lang.String) {
-        return (java.lang.String) ref;
-      } else {
-        com.google.protobuf.ByteString bs = 
-            (com.google.protobuf.ByteString) ref;
-        java.lang.String s = bs.toStringUtf8();
-        if (bs.isValidUtf8()) {
-          path_ = s;
-        }
-        return s;
-      }
-    }
-    /**
-     * <code>optional string path = 2;</code>
-     */
-    public com.google.protobuf.ByteString
-        getPathBytes() {
-      java.lang.Object ref = path_;
-      if (ref instanceof java.lang.String) {
-        com.google.protobuf.ByteString b = 
-            com.google.protobuf.ByteString.copyFromUtf8(
-                (java.lang.String) ref);
-        path_ = b;
-        return b;
-      } else {
-        return (com.google.protobuf.ByteString) ref;
-      }
-    }
-
-    private void initFields() {
-      name_ = "";
-      path_ = "";
-    }
-    private byte memoizedIsInitialized = -1;
-    public final boolean isInitialized() {
-      byte isInitialized = memoizedIsInitialized;
-      if (isInitialized != -1) return isInitialized == 1;
-
-      memoizedIsInitialized = 1;
-      return true;
-    }
-
-    public void writeTo(com.google.protobuf.CodedOutputStream output)
-                        throws java.io.IOException {
-      getSerializedSize();
-      if (((bitField0_ & 0x00000001) == 0x00000001)) {
-        output.writeBytes(1, getNameBytes());
-      }
-      if (((bitField0_ & 0x00000002) == 0x00000002)) {
-        output.writeBytes(2, getPathBytes());
-      }
-      getUnknownFields().writeTo(output);
-    }
-
-    private int memoizedSerializedSize = -1;
-    public int getSerializedSize() {
-      int size = memoizedSerializedSize;
-      if (size != -1) return size;
-
-      size = 0;
-      if (((bitField0_ & 0x00000001) == 0x00000001)) {
-        size += com.google.protobuf.CodedOutputStream
-          .computeBytesSize(1, getNameBytes());
-      }
-      if (((bitField0_ & 0x00000002) == 0x00000002)) {
-        size += com.google.protobuf.CodedOutputStream
-          .computeBytesSize(2, getPathBytes());
-      }
-      size += getUnknownFields().getSerializedSize();
-      memoizedSerializedSize = size;
-      return size;
-    }
-
-    private static final long serialVersionUID = 0L;
-    @java.lang.Override
-    protected java.lang.Object writeReplace()
-        throws java.io.ObjectStreamException {
-      return super.writeReplace();
-    }
-
-    public static org.apache.drill.exec.proto.ExecProtos.ViewPointer parseFrom(
-        com.google.protobuf.ByteString data)
-        throws com.google.protobuf.InvalidProtocolBufferException {
-      return PARSER.parseFrom(data);
-    }
-    public static org.apache.drill.exec.proto.ExecProtos.ViewPointer parseFrom(
-        com.google.protobuf.ByteString data,
-        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-        throws com.google.protobuf.InvalidProtocolBufferException {
-      return PARSER.parseFrom(data, extensionRegistry);
-    }
-    public static org.apache.drill.exec.proto.ExecProtos.ViewPointer parseFrom(byte[] data)
-        throws com.google.protobuf.InvalidProtocolBufferException {
-      return PARSER.parseFrom(data);
-    }
-    public static org.apache.drill.exec.proto.ExecProtos.ViewPointer parseFrom(
-        byte[] data,
-        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-        throws com.google.protobuf.InvalidProtocolBufferException {
-      return PARSER.parseFrom(data, extensionRegistry);
-    }
-    public static org.apache.drill.exec.proto.ExecProtos.ViewPointer parseFrom(java.io.InputStream input)
-        throws java.io.IOException {
-      return PARSER.parseFrom(input);
-    }
-    public static org.apache.drill.exec.proto.ExecProtos.ViewPointer parseFrom(
-        java.io.InputStream input,
-        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-        throws java.io.IOException {
-      return PARSER.parseFrom(input, extensionRegistry);
-    }
-    public static org.apache.drill.exec.proto.ExecProtos.ViewPointer parseDelimitedFrom(java.io.InputStream input)
-        throws java.io.IOException {
-      return PARSER.parseDelimitedFrom(input);
-    }
-    public static org.apache.drill.exec.proto.ExecProtos.ViewPointer parseDelimitedFrom(
-        java.io.InputStream input,
-        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-        throws java.io.IOException {
-      return PARSER.parseDelimitedFrom(input, extensionRegistry);
-    }
-    public static org.apache.drill.exec.proto.ExecProtos.ViewPointer parseFrom(
-        com.google.protobuf.CodedInputStream input)
-        throws java.io.IOException {
-      return PARSER.parseFrom(input);
-    }
-    public static org.apache.drill.exec.proto.ExecProtos.ViewPointer parseFrom(
-        com.google.protobuf.CodedInputStream input,
-        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-        throws java.io.IOException {
-      return PARSER.parseFrom(input, extensionRegistry);
-    }
-
-    public static Builder newBuilder() { return Builder.create(); }
-    public Builder newBuilderForType() { return newBuilder(); }
-    public static Builder newBuilder(org.apache.drill.exec.proto.ExecProtos.ViewPointer prototype) {
-      return newBuilder().mergeFrom(prototype);
-    }
-    public Builder toBuilder() { return newBuilder(this); }
-
-    @java.lang.Override
-    protected Builder newBuilderForType(
-        com.google.protobuf.GeneratedMessage.BuilderParent parent) {
-      Builder builder = new Builder(parent);
-      return builder;
-    }
-    /**
-     * Protobuf type {@code exec.bit.ViewPointer}
-     */
-    public static final class Builder extends
-        com.google.protobuf.GeneratedMessage.Builder<Builder>
-       implements org.apache.drill.exec.proto.ExecProtos.ViewPointerOrBuilder {
-      public static final com.google.protobuf.Descriptors.Descriptor
-          getDescriptor() {
-        return org.apache.drill.exec.proto.ExecProtos.internal_static_exec_bit_ViewPointer_descriptor;
-      }
-
-      protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
-          internalGetFieldAccessorTable() {
-        return org.apache.drill.exec.proto.ExecProtos.internal_static_exec_bit_ViewPointer_fieldAccessorTable
-            .ensureFieldAccessorsInitialized(
-                org.apache.drill.exec.proto.ExecProtos.ViewPointer.class, org.apache.drill.exec.proto.ExecProtos.ViewPointer.Builder.class);
-      }
-
-      // Construct using org.apache.drill.exec.proto.ExecProtos.ViewPointer.newBuilder()
-      private Builder() {
-        maybeForceBuilderInitialization();
-      }
-
-      private Builder(
-          com.google.protobuf.GeneratedMessage.BuilderParent parent) {
-        super(parent);
-        maybeForceBuilderInitialization();
-      }
-      private void maybeForceBuilderInitialization() {
-        if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
-        }
-      }
-      private static Builder create() {
-        return new Builder();
-      }
-
-      public Builder clear() {
-        super.clear();
-        name_ = "";
-        bitField0_ = (bitField0_ & ~0x00000001);
-        path_ = "";
-        bitField0_ = (bitField0_ & ~0x00000002);
-        return this;
-      }
-
-      public Builder clone() {
-        return create().mergeFrom(buildPartial());
-      }
-
-      public com.google.protobuf.Descriptors.Descriptor
-          getDescriptorForType() {
-        return org.apache.drill.exec.proto.ExecProtos.internal_static_exec_bit_ViewPointer_descriptor;
-      }
-
-      public org.apache.drill.exec.proto.ExecProtos.ViewPointer getDefaultInstanceForType() {
-        return org.apache.drill.exec.proto.ExecProtos.ViewPointer.getDefaultInstance();
-      }
-
-      public org.apache.drill.exec.proto.ExecProtos.ViewPointer build() {
-        org.apache.drill.exec.proto.ExecProtos.ViewPointer result = buildPartial();
-        if (!result.isInitialized()) {
-          throw newUninitializedMessageException(result);
-        }
-        return result;
-      }
-
-      public org.apache.drill.exec.proto.ExecProtos.ViewPointer buildPartial() {
-        org.apache.drill.exec.proto.ExecProtos.ViewPointer result = new org.apache.drill.exec.proto.ExecProtos.ViewPointer(this);
-        int from_bitField0_ = bitField0_;
-        int to_bitField0_ = 0;
-        if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
-          to_bitField0_ |= 0x00000001;
-        }
-        result.name_ = name_;
-        if (((from_bitField0_ & 0x00000002) == 0x00000002)) {
-          to_bitField0_ |= 0x00000002;
-        }
-        result.path_ = path_;
-        result.bitField0_ = to_bitField0_;
-        onBuilt();
-        return result;
-      }
-
-      public Builder mergeFrom(com.google.protobuf.Message other) {
-        if (other instanceof org.apache.drill.exec.proto.ExecProtos.ViewPointer) {
-          return mergeFrom((org.apache.drill.exec.proto.ExecProtos.ViewPointer)other);
-        } else {
-          super.mergeFrom(other);
-          return this;
-        }
-      }
-
-      public Builder mergeFrom(org.apache.drill.exec.proto.ExecProtos.ViewPointer other) {
-        if (other == org.apache.drill.exec.proto.ExecProtos.ViewPointer.getDefaultInstance()) return this;
-        if (other.hasName()) {
-          bitField0_ |= 0x00000001;
-          name_ = other.name_;
-          onChanged();
-        }
-        if (other.hasPath()) {
-          bitField0_ |= 0x00000002;
-          path_ = other.path_;
-          onChanged();
-        }
-        this.mergeUnknownFields(other.getUnknownFields());
-        return this;
-      }
-
-      public final boolean isInitialized() {
-        return true;
-      }
-
-      public Builder mergeFrom(
-          com.google.protobuf.CodedInputStream input,
-          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-          throws java.io.IOException {
-        org.apache.drill.exec.proto.ExecProtos.ViewPointer parsedMessage = null;
-        try {
-          parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
-        } catch (com.google.protobuf.InvalidProtocolBufferException e) {
-          parsedMessage = (org.apache.drill.exec.proto.ExecProtos.ViewPointer) e.getUnfinishedMessage();
-          throw e;
-        } finally {
-          if (parsedMessage != null) {
-            mergeFrom(parsedMessage);
-          }
-        }
-        return this;
-      }
-      private int bitField0_;
-
-      // optional string name = 1;
-      private java.lang.Object name_ = "";
-      /**
-       * <code>optional string name = 1;</code>
-       */
-      public boolean hasName() {
-        return ((bitField0_ & 0x00000001) == 0x00000001);
-      }
-      /**
-       * <code>optional string name = 1;</code>
-       */
-      public java.lang.String getName() {
-        java.lang.Object ref = name_;
-        if (!(ref instanceof java.lang.String)) {
-          java.lang.String s = ((com.google.protobuf.ByteString) ref)
-              .toStringUtf8();
-          name_ = s;
-          return s;
-        } else {
-          return (java.lang.String) ref;
-        }
-      }
-      /**
-       * <code>optional string name = 1;</code>
-       */
-      public com.google.protobuf.ByteString
-          getNameBytes() {
-        java.lang.Object ref = name_;
-        if (ref instanceof String) {
-          com.google.protobuf.ByteString b = 
-              com.google.protobuf.ByteString.copyFromUtf8(
-                  (java.lang.String) ref);
-          name_ = b;
-          return b;
-        } else {
-          return (com.google.protobuf.ByteString) ref;
-        }
-      }
-      /**
-       * <code>optional string name = 1;</code>
-       */
-      public Builder setName(
-          java.lang.String value) {
-        if (value == null) {
-    throw new NullPointerException();
-  }
-  bitField0_ |= 0x00000001;
-        name_ = value;
-        onChanged();
-        return this;
-      }
-      /**
-       * <code>optional string name = 1;</code>
-       */
-      public Builder clearName() {
-        bitField0_ = (bitField0_ & ~0x00000001);
-        name_ = getDefaultInstance().getName();
-        onChanged();
-        return this;
-      }
-      /**
-       * <code>optional string name = 1;</code>
-       */
-      public Builder setNameBytes(
-          com.google.protobuf.ByteString value) {
-        if (value == null) {
-    throw new NullPointerException();
-  }
-  bitField0_ |= 0x00000001;
-        name_ = value;
-        onChanged();
-        return this;
-      }
-
-      // optional string path = 2;
-      private java.lang.Object path_ = "";
-      /**
-       * <code>optional string path = 2;</code>
-       */
-      public boolean hasPath() {
-        return ((bitField0_ & 0x00000002) == 0x00000002);
-      }
-      /**
-       * <code>optional string path = 2;</code>
-       */
-      public java.lang.String getPath() {
-        java.lang.Object ref = path_;
-        if (!(ref instanceof java.lang.String)) {
-          java.lang.String s = ((com.google.protobuf.ByteString) ref)
-              .toStringUtf8();
-          path_ = s;
-          return s;
-        } else {
-          return (java.lang.String) ref;
-        }
-      }
-      /**
-       * <code>optional string path = 2;</code>
-       */
-      public com.google.protobuf.ByteString
-          getPathBytes() {
-        java.lang.Object ref = path_;
-        if (ref instanceof String) {
-          com.google.protobuf.ByteString b = 
-              com.google.protobuf.ByteString.copyFromUtf8(
-                  (java.lang.String) ref);
-          path_ = b;
-          return b;
-        } else {
-          return (com.google.protobuf.ByteString) ref;
-        }
-      }
-      /**
-       * <code>optional string path = 2;</code>
-       */
-      public Builder setPath(
-          java.lang.String value) {
-        if (value == null) {
-    throw new NullPointerException();
-  }
-  bitField0_ |= 0x00000002;
-        path_ = value;
-        onChanged();
-        return this;
-      }
-      /**
-       * <code>optional string path = 2;</code>
-       */
-      public Builder clearPath() {
-        bitField0_ = (bitField0_ & ~0x00000002);
-        path_ = getDefaultInstance().getPath();
-        onChanged();
-        return this;
-      }
-      /**
-       * <code>optional string path = 2;</code>
-       */
-      public Builder setPathBytes(
-          com.google.protobuf.ByteString value) {
-        if (value == null) {
-    throw new NullPointerException();
-  }
-  bitField0_ |= 0x00000002;
-        path_ = value;
-        onChanged();
-        return this;
-      }
-
-      // @@protoc_insertion_point(builder_scope:exec.bit.ViewPointer)
-    }
-
-    static {
-      defaultInstance = new ViewPointer(true);
-      defaultInstance.initFields();
-    }
-
-    // @@protoc_insertion_point(class_scope:exec.bit.ViewPointer)
-  }
-
   private static com.google.protobuf.Descriptors.Descriptor
     internal_static_exec_bit_FragmentHandle_descriptor;
   private static
     com.google.protobuf.GeneratedMessage.FieldAccessorTable
       internal_static_exec_bit_FragmentHandle_fieldAccessorTable;
-  private static com.google.protobuf.Descriptors.Descriptor
-    internal_static_exec_bit_ViewPointer_descriptor;
-  private static
-    com.google.protobuf.GeneratedMessage.FieldAccessorTable
-      internal_static_exec_bit_ViewPointer_fieldAccessorTable;
 
   public static com.google.protobuf.Descriptors.FileDescriptor
       getDescriptor() {
@@ -1344,9 +712,8 @@ public final class ExecProtos {
       "ination.proto\032\023UserBitShared.proto\"n\n\016Fr" +
       "agmentHandle\022&\n\010query_id\030\001 \001(\0132\024.exec.sh" +
       "ared.QueryId\022\031\n\021major_fragment_id\030\002 \001(\005\022" +
-      "\031\n\021minor_fragment_id\030\003 \001(\005\")\n\013ViewPointe" +
-      "r\022\014\n\004name\030\001 \001(\t\022\014\n\004path\030\002 \001(\tB+\n\033org.apa" +
-      "che.drill.exec.protoB\nExecProtosH\001"
+      "\031\n\021minor_fragment_id\030\003 \001(\005B+\n\033org.apache" +
+      ".drill.exec.protoB\nExecProtosH\001"
     };
     com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
       new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() {
@@ -1359,12 +726,6 @@ public final class ExecProtos {
             com.google.protobuf.GeneratedMessage.FieldAccessorTable(
               internal_static_exec_bit_FragmentHandle_descriptor,
               new java.lang.String[] { "QueryId", "MajorFragmentId", "MinorFragmentId", });
-          internal_static_exec_bit_ViewPointer_descriptor =
-            getDescriptor().getMessageTypes().get(1);
-          internal_static_exec_bit_ViewPointer_fieldAccessorTable = new
-            com.google.protobuf.GeneratedMessage.FieldAccessorTable(
-              internal_static_exec_bit_ViewPointer_descriptor,
-              new java.lang.String[] { "Name", "Path", });
           return null;
         }
       };

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/2dec152b/protocol/src/main/java/org/apache/drill/exec/proto/SchemaExecProtos.java
----------------------------------------------------------------------
diff --git a/protocol/src/main/java/org/apache/drill/exec/proto/SchemaExecProtos.java b/protocol/src/main/java/org/apache/drill/exec/proto/SchemaExecProtos.java
index 4af5e68..1775f30 100644
--- a/protocol/src/main/java/org/apache/drill/exec/proto/SchemaExecProtos.java
+++ b/protocol/src/main/java/org/apache/drill/exec/proto/SchemaExecProtos.java
@@ -151,122 +151,4 @@ public final class SchemaExecProtos
         }
     }
 
-    public static final class ViewPointer
-    {
-        public static final org.apache.drill.exec.proto.SchemaExecProtos.ViewPointer.MessageSchema WRITE =
-            new org.apache.drill.exec.proto.SchemaExecProtos.ViewPointer.MessageSchema();
-        public static final org.apache.drill.exec.proto.SchemaExecProtos.ViewPointer.BuilderSchema MERGE =
-            new org.apache.drill.exec.proto.SchemaExecProtos.ViewPointer.BuilderSchema();
-        
-        public static class MessageSchema implements com.dyuproject.protostuff.Schema<org.apache.drill.exec.proto.ExecProtos.ViewPointer>
-        {
-            public void writeTo(com.dyuproject.protostuff.Output output, org.apache.drill.exec.proto.ExecProtos.ViewPointer message) throws java.io.IOException
-            {
-                if(message.hasName())
-                    output.writeString(1, message.getName(), false);
-                if(message.hasPath())
-                    output.writeString(2, message.getPath(), false);
-            }
-            public boolean isInitialized(org.apache.drill.exec.proto.ExecProtos.ViewPointer message)
-            {
-                return message.isInitialized();
-            }
-            public java.lang.String getFieldName(int number)
-            {
-                return org.apache.drill.exec.proto.SchemaExecProtos.ViewPointer.getFieldName(number);
-            }
-            public int getFieldNumber(java.lang.String name)
-            {
-                return org.apache.drill.exec.proto.SchemaExecProtos.ViewPointer.getFieldNumber(name);
-            }
-            public java.lang.Class<org.apache.drill.exec.proto.ExecProtos.ViewPointer> typeClass()
-            {
-                return org.apache.drill.exec.proto.ExecProtos.ViewPointer.class;
-            }
-            public java.lang.String messageName()
-            {
-                return org.apache.drill.exec.proto.ExecProtos.ViewPointer.class.getSimpleName();
-            }
-            public java.lang.String messageFullName()
-            {
-                return org.apache.drill.exec.proto.ExecProtos.ViewPointer.class.getName();
-            }
-            //unused
-            public void mergeFrom(com.dyuproject.protostuff.Input input, org.apache.drill.exec.proto.ExecProtos.ViewPointer message) throws java.io.IOException {}
-            public org.apache.drill.exec.proto.ExecProtos.ViewPointer newMessage() { return null; }
-        }
-        public static class BuilderSchema implements com.dyuproject.protostuff.Schema<org.apache.drill.exec.proto.ExecProtos.ViewPointer.Builder>
-        {
-            public void mergeFrom(com.dyuproject.protostuff.Input input, org.apache.drill.exec.proto.ExecProtos.ViewPointer.Builder builder) throws java.io.IOException
-            {
-                for(int number = input.readFieldNumber(this);; number = input.readFieldNumber(this))
-                {
-                    switch(number)
-                    {
-                        case 0:
-                            return;
-                        case 1:
-                            builder.setName(input.readString());
-                            break;
-                        case 2:
-                            builder.setPath(input.readString());
-                            break;
-                        default:
-                            input.handleUnknownField(number, this);
-                    }
-                }
-            }
-            public boolean isInitialized(org.apache.drill.exec.proto.ExecProtos.ViewPointer.Builder builder)
-            {
-                return builder.isInitialized();
-            }
-            public org.apache.drill.exec.proto.ExecProtos.ViewPointer.Builder newMessage()
-            {
-                return org.apache.drill.exec.proto.ExecProtos.ViewPointer.newBuilder();
-            }
-            public java.lang.String getFieldName(int number)
-            {
-                return org.apache.drill.exec.proto.SchemaExecProtos.ViewPointer.getFieldName(number);
-            }
-            public int getFieldNumber(java.lang.String name)
-            {
-                return org.apache.drill.exec.proto.SchemaExecProtos.ViewPointer.getFieldNumber(name);
-            }
-            public java.lang.Class<org.apache.drill.exec.proto.ExecProtos.ViewPointer.Builder> typeClass()
-            {
-                return org.apache.drill.exec.proto.ExecProtos.ViewPointer.Builder.class;
-            }
-            public java.lang.String messageName()
-            {
-                return org.apache.drill.exec.proto.ExecProtos.ViewPointer.class.getSimpleName();
-            }
-            public java.lang.String messageFullName()
-            {
-                return org.apache.drill.exec.proto.ExecProtos.ViewPointer.class.getName();
-            }
-            //unused
-            public void writeTo(com.dyuproject.protostuff.Output output, org.apache.drill.exec.proto.ExecProtos.ViewPointer.Builder builder) throws java.io.IOException {}
-        }
-        public static java.lang.String getFieldName(int number)
-        {
-            switch(number)
-            {
-                case 1: return "name";
-                case 2: return "path";
-                default: return null;
-            }
-        }
-        public static int getFieldNumber(java.lang.String name)
-        {
-            java.lang.Integer number = fieldMap.get(name);
-            return number == null ? 0 : number.intValue();
-        }
-        private static final java.util.HashMap<java.lang.String,java.lang.Integer> fieldMap = new java.util.HashMap<java.lang.String,java.lang.Integer>();
-        static
-        {
-            fieldMap.put("name", 1);
-            fieldMap.put("path", 2);
-        }
-    }
-
 }