drill-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From par...@apache.org
Subject [1/9] drill git commit: DRILL-2498: Separate QueryResult into two messages QueryResult and QueryData
Date Sat, 04 Apr 2015 02:37:27 GMT
Repository: drill
Updated Branches:
  refs/heads/master 10be89fe0 -> 4f213570f


http://git-wip-us.apache.org/repos/asf/drill/blob/1d9d82b0/protocol/src/main/java/org/apache/drill/exec/proto/UserProtos.java
----------------------------------------------------------------------
diff --git a/protocol/src/main/java/org/apache/drill/exec/proto/UserProtos.java b/protocol/src/main/java/org/apache/drill/exec/proto/UserProtos.java
index 048bd20..0b81926 100644
--- a/protocol/src/main/java/org/apache/drill/exec/proto/UserProtos.java
+++ b/protocol/src/main/java/org/apache/drill/exec/proto/UserProtos.java
@@ -56,6 +56,10 @@ public final class UserProtos {
     RUN_QUERY(3, 3),
     /**
      * <code>CANCEL_QUERY = 4;</code>
+     *
+     * <pre>
+     * user is sending a query cancellation request to the drillbit
+     * </pre>
      */
     CANCEL_QUERY(4, 4),
     /**
@@ -63,13 +67,13 @@ public final class UserProtos {
      */
     REQUEST_RESULTS(5, 5),
     /**
-     * <code>QUERY_RESULT = 6;</code>
+     * <code>QUERY_DATA = 6;</code>
      *
      * <pre>
      * bit to user
      * </pre>
      */
-    QUERY_RESULT(6, 6),
+    QUERY_DATA(6, 6),
     /**
      * <code>QUERY_HANDLE = 7;</code>
      */
@@ -82,6 +86,14 @@ public final class UserProtos {
      * <code>RESP_FUNCTION_LIST = 9;</code>
      */
     RESP_FUNCTION_LIST(9, 9),
+    /**
+     * <code>QUERY_RESULT = 10;</code>
+     *
+     * <pre>
+     * drillbit is reporting a query status change, most likely a terminal message, to the
user
+     * </pre>
+     */
+    QUERY_RESULT(10, 10),
     ;
 
     /**
@@ -106,6 +118,10 @@ public final class UserProtos {
     public static final int RUN_QUERY_VALUE = 3;
     /**
      * <code>CANCEL_QUERY = 4;</code>
+     *
+     * <pre>
+     * user is sending a query cancellation request to the drillbit
+     * </pre>
      */
     public static final int CANCEL_QUERY_VALUE = 4;
     /**
@@ -113,13 +129,13 @@ public final class UserProtos {
      */
     public static final int REQUEST_RESULTS_VALUE = 5;
     /**
-     * <code>QUERY_RESULT = 6;</code>
+     * <code>QUERY_DATA = 6;</code>
      *
      * <pre>
      * bit to user
      * </pre>
      */
-    public static final int QUERY_RESULT_VALUE = 6;
+    public static final int QUERY_DATA_VALUE = 6;
     /**
      * <code>QUERY_HANDLE = 7;</code>
      */
@@ -132,6 +148,14 @@ public final class UserProtos {
      * <code>RESP_FUNCTION_LIST = 9;</code>
      */
     public static final int RESP_FUNCTION_LIST_VALUE = 9;
+    /**
+     * <code>QUERY_RESULT = 10;</code>
+     *
+     * <pre>
+     * drillbit is reporting a query status change, most likely a terminal message, to the
user
+     * </pre>
+     */
+    public static final int QUERY_RESULT_VALUE = 10;
 
 
     public final int getNumber() { return value; }
@@ -144,10 +168,11 @@ public final class UserProtos {
         case 3: return RUN_QUERY;
         case 4: return CANCEL_QUERY;
         case 5: return REQUEST_RESULTS;
-        case 6: return QUERY_RESULT;
+        case 6: return QUERY_DATA;
         case 7: return QUERY_HANDLE;
         case 8: return REQ_META_FUNCTIONS;
         case 9: return RESP_FUNCTION_LIST;
+        case 10: return QUERY_RESULT;
         default: return null;
       }
     }
@@ -4343,14 +4368,14 @@ public final class UserProtos {
       "lts_mode\030\001 \001(\0162\033.exec.user.QueryResultsM" +
       "ode\022$\n\004type\030\002 \001(\0162\026.exec.shared.QueryTyp" +
       "e\022\014\n\004plan\030\003 \001(\t\")\n\022BitToUserHandshake\022\023\n" +
-      "\013rpc_version\030\002 \001(\005*\270\001\n\007RpcType\022\r\n\tHANDSH" +
+      "\013rpc_version\030\002 \001(\005*\310\001\n\007RpcType\022\r\n\tHANDSH" +
       "AKE\020\000\022\007\n\003ACK\020\001\022\013\n\007GOODBYE\020\002\022\r\n\tRUN_QUERY"
+
       "\020\003\022\020\n\014CANCEL_QUERY\020\004\022\023\n\017REQUEST_RESULTS\020" +
-      "\005\022\020\n\014QUERY_RESULT\020\006\022\020\n\014QUERY_HANDLE\020\007\022\026\n",
-      "\022REQ_META_FUNCTIONS\020\010\022\026\n\022RESP_FUNCTION_L" +
-      "IST\020\t*#\n\020QueryResultsMode\022\017\n\013STREAM_FULL" +
-      "\020\001B+\n\033org.apache.drill.exec.protoB\nUserP" +
-      "rotosH\001"
+      "\005\022\016\n\nQUERY_DATA\020\006\022\020\n\014QUERY_HANDLE\020\007\022\026\n\022R",
+      "EQ_META_FUNCTIONS\020\010\022\026\n\022RESP_FUNCTION_LIS" +
+      "T\020\t\022\020\n\014QUERY_RESULT\020\n*#\n\020QueryResultsMod" +
+      "e\022\017\n\013STREAM_FULL\020\001B+\n\033org.apache.drill.e" +
+      "xec.protoB\nUserProtosH\001"
     };
     com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
       new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() {

http://git-wip-us.apache.org/repos/asf/drill/blob/1d9d82b0/protocol/src/main/java/org/apache/drill/exec/proto/beans/QueryData.java
----------------------------------------------------------------------
diff --git a/protocol/src/main/java/org/apache/drill/exec/proto/beans/QueryData.java b/protocol/src/main/java/org/apache/drill/exec/proto/beans/QueryData.java
new file mode 100644
index 0000000..70a6426
--- /dev/null
+++ b/protocol/src/main/java/org/apache/drill/exec/proto/beans/QueryData.java
@@ -0,0 +1,211 @@
+/**
+ * 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.
+ */
+// Generated by http://code.google.com/p/protostuff/ ... DO NOT EDIT!
+// Generated from protobuf
+
+package org.apache.drill.exec.proto.beans;
+
+import java.io.Externalizable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+
+import com.dyuproject.protostuff.GraphIOUtil;
+import com.dyuproject.protostuff.Input;
+import com.dyuproject.protostuff.Message;
+import com.dyuproject.protostuff.Output;
+import com.dyuproject.protostuff.Schema;
+
+public final class QueryData implements Externalizable, Message<QueryData>, Schema<QueryData>
+{
+
+    public static Schema<QueryData> getSchema()
+    {
+        return DEFAULT_INSTANCE;
+    }
+
+    public static QueryData getDefaultInstance()
+    {
+        return DEFAULT_INSTANCE;
+    }
+
+    static final QueryData DEFAULT_INSTANCE = new QueryData();
+
+    
+    private QueryId queryId;
+    private int rowCount;
+    private RecordBatchDef def;
+
+    public QueryData()
+    {
+        
+    }
+
+    // getters and setters
+
+    // queryId
+
+    public QueryId getQueryId()
+    {
+        return queryId;
+    }
+
+    public QueryData setQueryId(QueryId queryId)
+    {
+        this.queryId = queryId;
+        return this;
+    }
+
+    // rowCount
+
+    public int getRowCount()
+    {
+        return rowCount;
+    }
+
+    public QueryData setRowCount(int rowCount)
+    {
+        this.rowCount = rowCount;
+        return this;
+    }
+
+    // def
+
+    public RecordBatchDef getDef()
+    {
+        return def;
+    }
+
+    public QueryData setDef(RecordBatchDef def)
+    {
+        this.def = def;
+        return this;
+    }
+
+    // java serialization
+
+    public void readExternal(ObjectInput in) throws IOException
+    {
+        GraphIOUtil.mergeDelimitedFrom(in, this, this);
+    }
+
+    public void writeExternal(ObjectOutput out) throws IOException
+    {
+        GraphIOUtil.writeDelimitedTo(out, this, this);
+    }
+
+    // message method
+
+    public Schema<QueryData> cachedSchema()
+    {
+        return DEFAULT_INSTANCE;
+    }
+
+    // schema methods
+
+    public QueryData newMessage()
+    {
+        return new QueryData();
+    }
+
+    public Class<QueryData> typeClass()
+    {
+        return QueryData.class;
+    }
+
+    public String messageName()
+    {
+        return QueryData.class.getSimpleName();
+    }
+
+    public String messageFullName()
+    {
+        return QueryData.class.getName();
+    }
+
+    public boolean isInitialized(QueryData message)
+    {
+        return true;
+    }
+
+    public void mergeFrom(Input input, QueryData message) throws IOException
+    {
+        for(int number = input.readFieldNumber(this);; number = input.readFieldNumber(this))
+        {
+            switch(number)
+            {
+                case 0:
+                    return;
+                case 1:
+                    message.queryId = input.mergeObject(message.queryId, QueryId.getSchema());
+                    break;
+
+                case 2:
+                    message.rowCount = input.readInt32();
+                    break;
+                case 3:
+                    message.def = input.mergeObject(message.def, RecordBatchDef.getSchema());
+                    break;
+
+                default:
+                    input.handleUnknownField(number, this);
+            }   
+        }
+    }
+
+
+    public void writeTo(Output output, QueryData message) throws IOException
+    {
+        if(message.queryId != null)
+             output.writeObject(1, message.queryId, QueryId.getSchema(), false);
+
+
+        if(message.rowCount != 0)
+            output.writeInt32(2, message.rowCount, false);
+
+        if(message.def != null)
+             output.writeObject(3, message.def, RecordBatchDef.getSchema(), false);
+
+    }
+
+    public String getFieldName(int number)
+    {
+        switch(number)
+        {
+            case 1: return "queryId";
+            case 2: return "rowCount";
+            case 3: return "def";
+            default: return null;
+        }
+    }
+
+    public int getFieldNumber(String name)
+    {
+        final Integer number = __fieldMap.get(name);
+        return number == null ? 0 : number.intValue();
+    }
+
+    private static final java.util.HashMap<String,Integer> __fieldMap = new java.util.HashMap<String,Integer>();
+    static
+    {
+        __fieldMap.put("queryId", 1);
+        __fieldMap.put("rowCount", 2);
+        __fieldMap.put("def", 3);
+    }
+    
+}

http://git-wip-us.apache.org/repos/asf/drill/blob/1d9d82b0/protocol/src/main/java/org/apache/drill/exec/proto/beans/QueryResult.java
----------------------------------------------------------------------
diff --git a/protocol/src/main/java/org/apache/drill/exec/proto/beans/QueryResult.java b/protocol/src/main/java/org/apache/drill/exec/proto/beans/QueryResult.java
index d8eb92a..474e330 100644
--- a/protocol/src/main/java/org/apache/drill/exec/proto/beans/QueryResult.java
+++ b/protocol/src/main/java/org/apache/drill/exec/proto/beans/QueryResult.java
@@ -87,15 +87,7 @@ public final class QueryResult implements Externalizable, Message<QueryResult>,
     
     private QueryState queryState;
     private QueryId queryId;
-    private Boolean isLastChunk;
-    private int rowCount;
-    private long recordsScan;
-    private long recordsError;
-    private long submissionTime;
-    private List<NodeStatus> nodeStatus;
     private List<DrillPBError> error;
-    private RecordBatchDef def;
-    private Boolean schemaChanged;
 
     public QueryResult()
     {
@@ -130,84 +122,6 @@ public final class QueryResult implements Externalizable, Message<QueryResult>,
         return this;
     }
 
-    // isLastChunk
-
-    public Boolean getIsLastChunk()
-    {
-        return isLastChunk;
-    }
-
-    public QueryResult setIsLastChunk(Boolean isLastChunk)
-    {
-        this.isLastChunk = isLastChunk;
-        return this;
-    }
-
-    // rowCount
-
-    public int getRowCount()
-    {
-        return rowCount;
-    }
-
-    public QueryResult setRowCount(int rowCount)
-    {
-        this.rowCount = rowCount;
-        return this;
-    }
-
-    // recordsScan
-
-    public long getRecordsScan()
-    {
-        return recordsScan;
-    }
-
-    public QueryResult setRecordsScan(long recordsScan)
-    {
-        this.recordsScan = recordsScan;
-        return this;
-    }
-
-    // recordsError
-
-    public long getRecordsError()
-    {
-        return recordsError;
-    }
-
-    public QueryResult setRecordsError(long recordsError)
-    {
-        this.recordsError = recordsError;
-        return this;
-    }
-
-    // submissionTime
-
-    public long getSubmissionTime()
-    {
-        return submissionTime;
-    }
-
-    public QueryResult setSubmissionTime(long submissionTime)
-    {
-        this.submissionTime = submissionTime;
-        return this;
-    }
-
-    // nodeStatus
-
-    public List<NodeStatus> getNodeStatusList()
-    {
-        return nodeStatus;
-    }
-
-    public QueryResult setNodeStatusList(List<NodeStatus> nodeStatus)
-    {
-        this.nodeStatus = nodeStatus;
-        return this;
-    }
-
     // error
 
     public List<DrillPBError> getErrorList()
@@ -221,32 +135,6 @@ public final class QueryResult implements Externalizable, Message<QueryResult>,
         return this;
     }
 
-    // def
-
-    public RecordBatchDef getDef()
-    {
-        return def;
-    }
-
-    public QueryResult setDef(RecordBatchDef def)
-    {
-        this.def = def;
-        return this;
-    }
-
-    // schemaChanged
-
-    public Boolean getSchemaChanged()
-    {
-        return schemaChanged;
-    }
-
-    public QueryResult setSchemaChanged(Boolean schemaChanged)
-    {
-        this.schemaChanged = schemaChanged;
-        return this;
-    }
-
     // java serialization
 
     public void readExternal(ObjectInput in) throws IOException
@@ -309,39 +197,11 @@ public final class QueryResult implements Externalizable, Message<QueryResult>,
                     break;
 
                 case 3:
-                    message.isLastChunk = input.readBool();
-                    break;
-                case 4:
-                    message.rowCount = input.readInt32();
-                    break;
-                case 5:
-                    message.recordsScan = input.readInt64();
-                    break;
-                case 6:
-                    message.recordsError = input.readInt64();
-                    break;
-                case 7:
-                    message.submissionTime = input.readInt64();
-                    break;
-                case 8:
-                    if(message.nodeStatus == null)
-                        message.nodeStatus = new ArrayList<NodeStatus>();
-                    message.nodeStatus.add(input.mergeObject(null, NodeStatus.getSchema()));
-                    break;
-
-                case 9:
                     if(message.error == null)
                         message.error = new ArrayList<DrillPBError>();
                     message.error.add(input.mergeObject(null, DrillPBError.getSchema()));
                     break;
 
-                case 10:
-                    message.def = input.mergeObject(message.def, RecordBatchDef.getSchema());
-                    break;
-
-                case 11:
-                    message.schemaChanged = input.readBool();
-                    break;
                 default:
                     input.handleUnknownField(number, this);
             }   
@@ -358,47 +218,15 @@ public final class QueryResult implements Externalizable, Message<QueryResult>,
              output.writeObject(2, message.queryId, QueryId.getSchema(), false);
 
 
-        if(message.isLastChunk != null)
-            output.writeBool(3, message.isLastChunk, false);
-
-        if(message.rowCount != 0)
-            output.writeInt32(4, message.rowCount, false);
-
-        if(message.recordsScan != 0)
-            output.writeInt64(5, message.recordsScan, false);
-
-        if(message.recordsError != 0)
-            output.writeInt64(6, message.recordsError, false);
-
-        if(message.submissionTime != 0)
-            output.writeInt64(7, message.submissionTime, false);
-
-        if(message.nodeStatus != null)
-        {
-            for(NodeStatus nodeStatus : message.nodeStatus)
-            {
-                if(nodeStatus != null)
-                    output.writeObject(8, nodeStatus, NodeStatus.getSchema(), true);
-            }
-        }
-
-
         if(message.error != null)
         {
             for(DrillPBError error : message.error)
             {
                 if(error != null)
-                    output.writeObject(9, error, DrillPBError.getSchema(), true);
+                    output.writeObject(3, error, DrillPBError.getSchema(), true);
             }
         }
 
-
-        if(message.def != null)
-             output.writeObject(10, message.def, RecordBatchDef.getSchema(), false);
-
-
-        if(message.schemaChanged != null)
-            output.writeBool(11, message.schemaChanged, false);
     }
 
     public String getFieldName(int number)
@@ -407,15 +235,7 @@ public final class QueryResult implements Externalizable, Message<QueryResult>,
         {
             case 1: return "queryState";
             case 2: return "queryId";
-            case 3: return "isLastChunk";
-            case 4: return "rowCount";
-            case 5: return "recordsScan";
-            case 6: return "recordsError";
-            case 7: return "submissionTime";
-            case 8: return "nodeStatus";
-            case 9: return "error";
-            case 10: return "def";
-            case 11: return "schemaChanged";
+            case 3: return "error";
             default: return null;
         }
     }
@@ -431,15 +251,7 @@ public final class QueryResult implements Externalizable, Message<QueryResult>,
     {
         __fieldMap.put("queryState", 1);
         __fieldMap.put("queryId", 2);
-        __fieldMap.put("isLastChunk", 3);
-        __fieldMap.put("rowCount", 4);
-        __fieldMap.put("recordsScan", 5);
-        __fieldMap.put("recordsError", 6);
-        __fieldMap.put("submissionTime", 7);
-        __fieldMap.put("nodeStatus", 8);
-        __fieldMap.put("error", 9);
-        __fieldMap.put("def", 10);
-        __fieldMap.put("schemaChanged", 11);
+        __fieldMap.put("error", 3);
     }
     
 }

http://git-wip-us.apache.org/repos/asf/drill/blob/1d9d82b0/protocol/src/main/java/org/apache/drill/exec/proto/beans/RpcType.java
----------------------------------------------------------------------
diff --git a/protocol/src/main/java/org/apache/drill/exec/proto/beans/RpcType.java b/protocol/src/main/java/org/apache/drill/exec/proto/beans/RpcType.java
index 3f1f9fd..4d03073 100644
--- a/protocol/src/main/java/org/apache/drill/exec/proto/beans/RpcType.java
+++ b/protocol/src/main/java/org/apache/drill/exec/proto/beans/RpcType.java
@@ -28,10 +28,11 @@ public enum RpcType implements com.dyuproject.protostuff.EnumLite<RpcType>
     RUN_QUERY(3),
     CANCEL_QUERY(4),
     REQUEST_RESULTS(5),
-    QUERY_RESULT(6),
+    QUERY_DATA(6),
     QUERY_HANDLE(7),
     REQ_META_FUNCTIONS(8),
-    RESP_FUNCTION_LIST(9);
+    RESP_FUNCTION_LIST(9),
+    QUERY_RESULT(10);
     
     public final int number;
     
@@ -55,10 +56,11 @@ public enum RpcType implements com.dyuproject.protostuff.EnumLite<RpcType>
             case 3: return RUN_QUERY;
             case 4: return CANCEL_QUERY;
             case 5: return REQUEST_RESULTS;
-            case 6: return QUERY_RESULT;
+            case 6: return QUERY_DATA;
             case 7: return QUERY_HANDLE;
             case 8: return REQ_META_FUNCTIONS;
             case 9: return RESP_FUNCTION_LIST;
+            case 10: return QUERY_RESULT;
             default: return null;
         }
     }

http://git-wip-us.apache.org/repos/asf/drill/blob/1d9d82b0/protocol/src/main/protobuf/User.proto
----------------------------------------------------------------------
diff --git a/protocol/src/main/protobuf/User.proto b/protocol/src/main/protobuf/User.proto
index 6c41a37..a083c59 100644
--- a/protocol/src/main/protobuf/User.proto
+++ b/protocol/src/main/protobuf/User.proto
@@ -14,16 +14,18 @@ enum RpcType {
   GOODBYE = 2;
 
   // user to bit
-  RUN_QUERY = 3;
-  CANCEL_QUERY = 4;
+  RUN_QUERY = 3; // user is submitting a new query to the drillbit
+  CANCEL_QUERY = 4; // user is sending a query cancellation request to the drillbit
   REQUEST_RESULTS = 5;
 
   // bit to user
-  QUERY_RESULT = 6;
+  QUERY_DATA = 6; // drillbit is sending a query result data batch to the user
   QUERY_HANDLE = 7;
 
   REQ_META_FUNCTIONS = 8;
   RESP_FUNCTION_LIST = 9;
+
+  QUERY_RESULT = 10; // drillbit is reporting a query status change, most likely a terminal
message, to the user
 }
 
 message Property {

http://git-wip-us.apache.org/repos/asf/drill/blob/1d9d82b0/protocol/src/main/protobuf/UserBitShared.proto
----------------------------------------------------------------------
diff --git a/protocol/src/main/protobuf/UserBitShared.proto b/protocol/src/main/protobuf/UserBitShared.proto
index 1971e62..5e44655 100644
--- a/protocol/src/main/protobuf/UserBitShared.proto
+++ b/protocol/src/main/protobuf/UserBitShared.proto
@@ -95,6 +95,9 @@ message NodeStatus {
 	optional int64 memory_footprint = 2;
 }
 
+/*
+ * Used by the server to report informations about the query state to the client
+ */
 message QueryResult {
 	enum QueryState {
 	  PENDING = 0;
@@ -107,15 +110,16 @@ message QueryResult {
 
 	optional QueryState query_state = 1;
 	optional QueryId query_id = 2;
-	optional bool is_last_chunk = 3;
-	optional int32 row_count = 4;
-	optional int64 records_scan = 5;
-	optional int64 records_error = 6;
-	optional int64 submission_time = 7;
-	repeated NodeStatus node_status = 8;
-	repeated DrillPBError error = 9;
-	optional RecordBatchDef def = 10;
-	optional bool schema_changed = 11;
+	repeated DrillPBError error = 3;
+}
+
+/*
+ * Used by the server when sending query result data batches to the client
+ */
+message QueryData {
+  optional QueryId query_id = 1;
+  optional int32 row_count = 2;
+  optional RecordBatchDef def = 3;
 }
 
 message QueryInfo {


Mime
View raw message