Repository: drill Updated Branches: refs/heads/master f07f32856 -> 6bba69d48
http://git-wip-us.apache.org/repos/asf/drill/blob/6bba69d4/protocol/src/main/java/org/apache/drill/exec/proto/beans/FragmentHandle.java ---------------------------------------------------------------------- diff --git a/protocol/src/main/java/org/apache/drill/exec/proto/beans/FragmentHandle.java b/protocol/src/main/java/org/apache/drill/exec/proto/beans/FragmentHandle.java index 6d8a183..36cee7c 100644 --- a/protocol/src/main/java/org/apache/drill/exec/proto/beans/FragmentHandle.java +++ b/protocol/src/main/java/org/apache/drill/exec/proto/beans/FragmentHandle.java @@ -50,6 +50,7 @@ public final class FragmentHandle implements Externalizable, Message<FragmentHan private QueryId queryId; private int majorFragmentId; private int minorFragmentId; + private QueryId parentQueryId; public FragmentHandle() { @@ -97,6 +98,19 @@ public final class FragmentHandle implements Externalizable, Message<FragmentHan return this; } + // parentQueryId + + public QueryId getParentQueryId() + { + return parentQueryId; + } + + public FragmentHandle setParentQueryId(QueryId parentQueryId) + { + this.parentQueryId = parentQueryId; + return this; + } + // java serialization public void readExternal(ObjectInput in) throws IOException @@ -161,6 +175,10 @@ public final class FragmentHandle implements Externalizable, Message<FragmentHan case 3: message.minorFragmentId = input.readInt32(); break; + case 4: + message.parentQueryId = input.mergeObject(message.parentQueryId, QueryId.getSchema()); + break; + default: input.handleUnknownField(number, this); } @@ -179,6 +197,10 @@ public final class FragmentHandle implements Externalizable, Message<FragmentHan if(message.minorFragmentId != 0) output.writeInt32(3, message.minorFragmentId, false); + + if(message.parentQueryId != null) + output.writeObject(4, message.parentQueryId, QueryId.getSchema(), false); + } public String getFieldName(int number) @@ -188,6 +210,7 @@ public final class FragmentHandle implements Externalizable, Message<FragmentHan case 1: return "queryId"; case 2: return "majorFragmentId"; case 3: return "minorFragmentId"; + case 4: return "parentQueryId"; default: return null; } } @@ -204,6 +227,7 @@ public final class FragmentHandle implements Externalizable, Message<FragmentHan __fieldMap.put("queryId", 1); __fieldMap.put("majorFragmentId", 2); __fieldMap.put("minorFragmentId", 3); + __fieldMap.put("parentQueryId", 4); } } http://git-wip-us.apache.org/repos/asf/drill/blob/6bba69d4/protocol/src/main/java/org/apache/drill/exec/proto/beans/GetQueryPlanFragments.java ---------------------------------------------------------------------- diff --git a/protocol/src/main/java/org/apache/drill/exec/proto/beans/GetQueryPlanFragments.java b/protocol/src/main/java/org/apache/drill/exec/proto/beans/GetQueryPlanFragments.java new file mode 100644 index 0000000..4c0109c --- /dev/null +++ b/protocol/src/main/java/org/apache/drill/exec/proto/beans/GetQueryPlanFragments.java @@ -0,0 +1,218 @@ +/** + * 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; +import com.dyuproject.protostuff.UninitializedMessageException; + +public final class GetQueryPlanFragments implements Externalizable, Message<GetQueryPlanFragments>, Schema<GetQueryPlanFragments> +{ + + public static Schema<GetQueryPlanFragments> getSchema() + { + return DEFAULT_INSTANCE; + } + + public static GetQueryPlanFragments getDefaultInstance() + { + return DEFAULT_INSTANCE; + } + + static final GetQueryPlanFragments DEFAULT_INSTANCE = new GetQueryPlanFragments(); + + static final Boolean DEFAULT_SPLIT_PLAN = new Boolean(false); + + private String query; + private QueryType type; + private Boolean splitPlan = DEFAULT_SPLIT_PLAN; + + public GetQueryPlanFragments() + { + + } + + public GetQueryPlanFragments( + String query + ) + { + this.query = query; + } + + // getters and setters + + // query + + public String getQuery() + { + return query; + } + + public GetQueryPlanFragments setQuery(String query) + { + this.query = query; + return this; + } + + // type + + public QueryType getType() + { + return type == null ? QueryType.SQL : type; + } + + public GetQueryPlanFragments setType(QueryType type) + { + this.type = type; + return this; + } + + // splitPlan + + public Boolean getSplitPlan() + { + return splitPlan; + } + + public GetQueryPlanFragments setSplitPlan(Boolean splitPlan) + { + this.splitPlan = splitPlan; + 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<GetQueryPlanFragments> cachedSchema() + { + return DEFAULT_INSTANCE; + } + + // schema methods + + public GetQueryPlanFragments newMessage() + { + return new GetQueryPlanFragments(); + } + + public Class<GetQueryPlanFragments> typeClass() + { + return GetQueryPlanFragments.class; + } + + public String messageName() + { + return GetQueryPlanFragments.class.getSimpleName(); + } + + public String messageFullName() + { + return GetQueryPlanFragments.class.getName(); + } + + public boolean isInitialized(GetQueryPlanFragments message) + { + return + message.query != null; + } + + public void mergeFrom(Input input, GetQueryPlanFragments message) throws IOException + { + for(int number = input.readFieldNumber(this);; number = input.readFieldNumber(this)) + { + switch(number) + { + case 0: + return; + case 1: + message.query = input.readString(); + break; + case 2: + message.type = QueryType.valueOf(input.readEnum()); + break; + case 3: + message.splitPlan = input.readBool(); + break; + default: + input.handleUnknownField(number, this); + } + } + } + + + public void writeTo(Output output, GetQueryPlanFragments message) throws IOException + { + if(message.query == null) + throw new UninitializedMessageException(message); + output.writeString(1, message.query, false); + + if(message.type != null) + output.writeEnum(2, message.type.number, false); + + if(message.splitPlan != null && message.splitPlan != DEFAULT_SPLIT_PLAN) + output.writeBool(3, message.splitPlan, false); + } + + public String getFieldName(int number) + { + switch(number) + { + case 1: return "query"; + case 2: return "type"; + case 3: return "splitPlan"; + 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("query", 1); + __fieldMap.put("type", 2); + __fieldMap.put("splitPlan", 3); + } + +} http://git-wip-us.apache.org/repos/asf/drill/blob/6bba69d4/protocol/src/main/java/org/apache/drill/exec/proto/beans/QueryPlanFragments.java ---------------------------------------------------------------------- diff --git a/protocol/src/main/java/org/apache/drill/exec/proto/beans/QueryPlanFragments.java b/protocol/src/main/java/org/apache/drill/exec/proto/beans/QueryPlanFragments.java new file mode 100644 index 0000000..c64baf8 --- /dev/null +++ b/protocol/src/main/java/org/apache/drill/exec/proto/beans/QueryPlanFragments.java @@ -0,0 +1,255 @@ +/** + * 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 java.util.ArrayList; +import java.util.List; + +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; +import com.dyuproject.protostuff.UninitializedMessageException; + +public final class QueryPlanFragments implements Externalizable, Message<QueryPlanFragments>, Schema<QueryPlanFragments> +{ + + public static Schema<QueryPlanFragments> getSchema() + { + return DEFAULT_INSTANCE; + } + + public static QueryPlanFragments getDefaultInstance() + { + return DEFAULT_INSTANCE; + } + + static final QueryPlanFragments DEFAULT_INSTANCE = new QueryPlanFragments(); + + + private QueryResult.QueryState status; + private QueryId queryId; + private List<PlanFragment> fragments; + private DrillPBError error; + + public QueryPlanFragments() + { + + } + + public QueryPlanFragments( + QueryResult.QueryState status + ) + { + this.status = status; + } + + // getters and setters + + // status + + public QueryResult.QueryState getStatus() + { + return status; + } + + public QueryPlanFragments setStatus(QueryResult.QueryState status) + { + this.status = status; + return this; + } + + // queryId + + public QueryId getQueryId() + { + return queryId; + } + + public QueryPlanFragments setQueryId(QueryId queryId) + { + this.queryId = queryId; + return this; + } + + // fragments + + public List<PlanFragment> getFragmentsList() + { + return fragments; + } + + public QueryPlanFragments setFragmentsList(List<PlanFragment> fragments) + { + this.fragments = fragments; + return this; + } + + // error + + public DrillPBError getError() + { + return error; + } + + public QueryPlanFragments setError(DrillPBError error) + { + this.error = error; + 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<QueryPlanFragments> cachedSchema() + { + return DEFAULT_INSTANCE; + } + + // schema methods + + public QueryPlanFragments newMessage() + { + return new QueryPlanFragments(); + } + + public Class<QueryPlanFragments> typeClass() + { + return QueryPlanFragments.class; + } + + public String messageName() + { + return QueryPlanFragments.class.getSimpleName(); + } + + public String messageFullName() + { + return QueryPlanFragments.class.getName(); + } + + public boolean isInitialized(QueryPlanFragments message) + { + return + message.status != null; + } + + public void mergeFrom(Input input, QueryPlanFragments message) throws IOException + { + for(int number = input.readFieldNumber(this);; number = input.readFieldNumber(this)) + { + switch(number) + { + case 0: + return; + case 1: + message.status = QueryResult.QueryState.valueOf(input.readEnum()); + break; + case 2: + message.queryId = input.mergeObject(message.queryId, QueryId.getSchema()); + break; + + case 3: + if(message.fragments == null) + message.fragments = new ArrayList<PlanFragment>(); + message.fragments.add(input.mergeObject(null, PlanFragment.getSchema())); + break; + + case 4: + message.error = input.mergeObject(message.error, DrillPBError.getSchema()); + break; + + default: + input.handleUnknownField(number, this); + } + } + } + + + public void writeTo(Output output, QueryPlanFragments message) throws IOException + { + if(message.status == null) + throw new UninitializedMessageException(message); + output.writeEnum(1, message.status.number, false); + + if(message.queryId != null) + output.writeObject(2, message.queryId, QueryId.getSchema(), false); + + + if(message.fragments != null) + { + for(PlanFragment fragments : message.fragments) + { + if(fragments != null) + output.writeObject(3, fragments, PlanFragment.getSchema(), true); + } + } + + + if(message.error != null) + output.writeObject(4, message.error, DrillPBError.getSchema(), false); + + } + + public String getFieldName(int number) + { + switch(number) + { + case 1: return "status"; + case 2: return "queryId"; + case 3: return "fragments"; + case 4: return "error"; + 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("status", 1); + __fieldMap.put("queryId", 2); + __fieldMap.put("fragments", 3); + __fieldMap.put("error", 4); + } + +} http://git-wip-us.apache.org/repos/asf/drill/blob/6bba69d4/protocol/src/main/java/org/apache/drill/exec/proto/beans/QueryType.java ---------------------------------------------------------------------- diff --git a/protocol/src/main/java/org/apache/drill/exec/proto/beans/QueryType.java b/protocol/src/main/java/org/apache/drill/exec/proto/beans/QueryType.java index 6c8f3c5..71f98f3 100644 --- a/protocol/src/main/java/org/apache/drill/exec/proto/beans/QueryType.java +++ b/protocol/src/main/java/org/apache/drill/exec/proto/beans/QueryType.java @@ -24,7 +24,8 @@ public enum QueryType implements com.dyuproject.protostuff.EnumLite<QueryType> { SQL(1), LOGICAL(2), - PHYSICAL(3); + PHYSICAL(3), + EXECUTION(4); public final int number; @@ -45,6 +46,7 @@ public enum QueryType implements com.dyuproject.protostuff.EnumLite<QueryType> case 1: return SQL; case 2: return LOGICAL; case 3: return PHYSICAL; + case 4: return EXECUTION; default: return null; } } http://git-wip-us.apache.org/repos/asf/drill/blob/6bba69d4/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 6687a86..5800183 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 @@ -29,8 +29,10 @@ public enum RpcType implements com.dyuproject.protostuff.EnumLite<RpcType> CANCEL_QUERY(4), REQUEST_RESULTS(5), RESUME_PAUSED_QUERY(11), + GET_QUERY_PLAN_FRAGMENTS(12), QUERY_DATA(6), QUERY_HANDLE(7), + QUERY_PLAN_FRAGMENTS(13), REQ_META_FUNCTIONS(8), RESP_FUNCTION_LIST(9), QUERY_RESULT(10); @@ -63,6 +65,8 @@ public enum RpcType implements com.dyuproject.protostuff.EnumLite<RpcType> case 9: return RESP_FUNCTION_LIST; case 10: return QUERY_RESULT; case 11: return RESUME_PAUSED_QUERY; + case 12: return GET_QUERY_PLAN_FRAGMENTS; + case 13: return QUERY_PLAN_FRAGMENTS; default: return null; } } http://git-wip-us.apache.org/repos/asf/drill/blob/6bba69d4/protocol/src/main/java/org/apache/drill/exec/proto/beans/RunQuery.java ---------------------------------------------------------------------- diff --git a/protocol/src/main/java/org/apache/drill/exec/proto/beans/RunQuery.java b/protocol/src/main/java/org/apache/drill/exec/proto/beans/RunQuery.java index 2c3f0f5..e6035d1 100644 --- a/protocol/src/main/java/org/apache/drill/exec/proto/beans/RunQuery.java +++ b/protocol/src/main/java/org/apache/drill/exec/proto/beans/RunQuery.java @@ -24,6 +24,8 @@ import java.io.Externalizable; import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput; +import java.util.ArrayList; +import java.util.List; import com.dyuproject.protostuff.GraphIOUtil; import com.dyuproject.protostuff.Input; @@ -50,6 +52,7 @@ public final class RunQuery implements Externalizable, Message<RunQuery>, Schema private QueryResultsMode resultsMode; private QueryType type; private String plan; + private List<PlanFragment> fragments; public RunQuery() { @@ -97,6 +100,19 @@ public final class RunQuery implements Externalizable, Message<RunQuery>, Schema return this; } + // fragments + + public List<PlanFragment> getFragmentsList() + { + return fragments; + } + + public RunQuery setFragmentsList(List<PlanFragment> fragments) + { + this.fragments = fragments; + return this; + } + // java serialization public void readExternal(ObjectInput in) throws IOException @@ -160,6 +176,12 @@ public final class RunQuery implements Externalizable, Message<RunQuery>, Schema case 3: message.plan = input.readString(); break; + case 4: + if(message.fragments == null) + message.fragments = new ArrayList<PlanFragment>(); + message.fragments.add(input.mergeObject(null, PlanFragment.getSchema())); + break; + default: input.handleUnknownField(number, this); } @@ -177,6 +199,16 @@ public final class RunQuery implements Externalizable, Message<RunQuery>, Schema if(message.plan != null) output.writeString(3, message.plan, false); + + if(message.fragments != null) + { + for(PlanFragment fragments : message.fragments) + { + if(fragments != null) + output.writeObject(4, fragments, PlanFragment.getSchema(), true); + } + } + } public String getFieldName(int number) @@ -186,6 +218,7 @@ public final class RunQuery implements Externalizable, Message<RunQuery>, Schema case 1: return "resultsMode"; case 2: return "type"; case 3: return "plan"; + case 4: return "fragments"; default: return null; } } @@ -202,6 +235,7 @@ public final class RunQuery implements Externalizable, Message<RunQuery>, Schema __fieldMap.put("resultsMode", 1); __fieldMap.put("type", 2); __fieldMap.put("plan", 3); + __fieldMap.put("fragments", 4); } } http://git-wip-us.apache.org/repos/asf/drill/blob/6bba69d4/protocol/src/main/protobuf/ExecutionProtos.proto ---------------------------------------------------------------------- diff --git a/protocol/src/main/protobuf/ExecutionProtos.proto b/protocol/src/main/protobuf/ExecutionProtos.proto index 8ad8c47..36cd12b 100644 --- a/protocol/src/main/protobuf/ExecutionProtos.proto +++ b/protocol/src/main/protobuf/ExecutionProtos.proto @@ -11,5 +11,6 @@ message FragmentHandle { optional exec.shared.QueryId query_id = 1; optional int32 major_fragment_id = 2; optional int32 minor_fragment_id = 3; + optional exec.shared.QueryId parent_query_id = 4; } http://git-wip-us.apache.org/repos/asf/drill/blob/6bba69d4/protocol/src/main/protobuf/User.proto ---------------------------------------------------------------------- diff --git a/protocol/src/main/protobuf/User.proto b/protocol/src/main/protobuf/User.proto index ceed3d8..da44955 100644 --- a/protocol/src/main/protobuf/User.proto +++ b/protocol/src/main/protobuf/User.proto @@ -6,6 +6,10 @@ option optimize_for = SPEED; import "SchemaDef.proto"; import "UserBitShared.proto"; +import "BitData.proto"; +import "BitControl.proto"; +import "ExecutionProtos.proto"; + ////// UserToBit RPC /////// enum RpcType { @@ -18,10 +22,12 @@ enum RpcType { CANCEL_QUERY = 4; // user is sending a query cancellation request to the drillbit REQUEST_RESULTS = 5; RESUME_PAUSED_QUERY = 11; // user is sending a query resume request to the drillbit + GET_QUERY_PLAN_FRAGMENTS = 12; // to get plan fragments from query // bit to user QUERY_DATA = 6; // drillbit is sending a query result data batch to the user QUERY_HANDLE = 7; + QUERY_PLAN_FRAGMENTS = 13; // return plan fragments REQ_META_FUNCTIONS = 8; RESP_FUNCTION_LIST = 9; @@ -57,6 +63,20 @@ message RunQuery { optional QueryResultsMode results_mode = 1; optional exec.shared.QueryType type = 2; optional string plan = 3; + repeated exec.bit.control.PlanFragment fragments = 4; +} + +message GetQueryPlanFragments { + required string query = 1; + optional exec.shared.QueryType type = 2; + optional bool split_plan = 3 [default = false]; +} + +message QueryPlanFragments { + required exec.shared.QueryResult.QueryState status = 1; + optional exec.shared.QueryId query_id = 2; + repeated exec.bit.control.PlanFragment fragments = 3; + optional exec.shared.DrillPBError error = 4; } enum QueryResultsMode { http://git-wip-us.apache.org/repos/asf/drill/blob/6bba69d4/protocol/src/main/protobuf/UserBitShared.proto ---------------------------------------------------------------------- diff --git a/protocol/src/main/protobuf/UserBitShared.proto b/protocol/src/main/protobuf/UserBitShared.proto index c44d2b2..2293dc0 100644 --- a/protocol/src/main/protobuf/UserBitShared.proto +++ b/protocol/src/main/protobuf/UserBitShared.proto @@ -18,6 +18,7 @@ enum QueryType { SQL = 1; LOGICAL = 2; PHYSICAL = 3; + EXECUTION = 4; } message UserCredentials {
