blob: fb1cf9551b107c23b0d10296551cd97390bde59f [file] [log] [blame]
/*
* 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.
*/
syntax = "proto2";
package univplan;
option cc_generic_services = true;
option java_generic_services = true;
import "univplan/proto/universal-plan-catalog.proto";
import "univplan/proto/universal-plan-expr.proto";
enum UNIVPLANNODETYPE {
UNIVPLAN_UNSET = 1;
UNIVPLAN_CONNECTOR = 2;
UNIVPLAN_SINK = 3;
UNIVPLAN_CONVERGE = 4;
UNIVPLAN_BROADCAST = 5;
UNIVPLAN_SHUFFLE = 6;
UNIVPLAN_AGG = 7;
UNIVPLAN_SCAN_SEQ = 8;
UNIVPLAN_SORT = 9;
UNIVPLAN_LIMIT = 10;
UNIVPLAN_APPEND = 11;
UNIVPLAN_NESTLOOP = 12;
UNIVPLAN_HASHJOIN = 13;
UNIVPLAN_MERGEJOIN = 14;
UNIVPLAN_MATERIAL = 15;
UNIVPLAN_RESULT = 16;
UNIVPLAN_HASH = 17;
UNIVPLAN_SUBQUERYSCAN = 18;
UNIVPLAN_UNIQUE = 19;
UNIVPLAN_INSERT = 20;
UNIVPLAN_SHAREINPUTSCAN = 21;
UNIVPLAN_EXT_GS_SCAN = 100;
UNIVPLAN_EXT_GS_FILTER = 101;
UNIVPLAN_EXT_GS_PROJ = 102;
}
message UnivPlanPlanNodePoly {
required UNIVPLANNODETYPE type = 1;
oneof value {
UnivPlanConnector connector = 2;
UnivPlanSink sink = 3;
UnivPlanConverge converge = 4;
UnivPlanBroadcast broadcast = 5;
UnivPlanShuffle shuffle = 6;
UnivPlanAgg agg = 7;
UnivPlanScanSeq scanSeq = 8;
UnivPlanSort sort = 9;
UnivPlanLimit limit = 10;
UnivPlanAppend append = 11;
UnivPlanNestLoop nestLoop = 12;
UnivPlanMergeJoin mergeJoin = 13;
UnivPlanHashJoin hashJoin = 14;
UnivPlanMaterial material = 15;
UnivPlanResult result = 16;
UnivPlanHash hash = 17;
UnivPlanSubqueryScan subqueryscan = 18;
UnivPlanUnique unique = 19;
UnivPlanInsert insert = 20;
UnivPlanShareInputScan shareinputscan = 21;
UnivPlanExtGSScan extGSScan = 100;
UnivPlanExtGSFilter extGSFilter = 101;
UnivPlanExtGSProj extGSProject = 102;
}
}
// The overall super node for plan nodes
message UnivPlanPlanNode {
repeated UnivPlanExprPoly targetList = 1; // Target list to be calculated
repeated UnivPlanExprPoly qualList = 2; // qual conditions
optional UnivPlanPlanNodePoly leftPlan = 3; // left plan tree
optional UnivPlanPlanNodePoly rightPlan = 4; // right plan tree
repeated UnivPlanExprPoly initPlan = 5; // un-correlated expr subselects
optional double planRows = 6; // estimated number of rows
optional int32 planRowWidth = 7; // estimated row width in bytes
optional int64 operatorMemKB = 8;
}
///////////////////////////////////////////////////////////////////////////////
// SCAN NODES BEGIN
///////////////////////////////////////////////////////////////////////////////
// The scan task
message UnivPlanScanTask {
// repeated UnivPlanScanFileSplit splits = 1;
optional bytes serializedSplits = 1;
}
message UnivPlanScanSeq {
required UnivPlanPlanNode super = 1;
required uint32 relId = 2;
optional bool readStatsOnly = 3;
repeated UnivPlanScanTask tasks = 4;
repeated int32 columnsToRead = 5;
}
///////////////////////////////////////////////////////////////////////////////
// SCAN NODES END
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
// SINK NODES BEGIN
///////////////////////////////////////////////////////////////////////////////
enum UNIVPLANCONNECTORTYPE {
CONNECTORTYPE_INVALID = 0;
CONNECTORTYPE_SHUFFLE = 1;
CONNECTORTYPE_BROADCAST = 2;
CONNECTORTYPE_CONVERGE = 3;
}
message UnivPlanConnector {
required UnivPlanPlanNode super = 1;
required UNIVPLANCONNECTORTYPE type = 2;
optional int32 stageno = 3 [default = -1];
repeated UnivPlanExprPoly hashExpr = 4;
repeated int32 colIdx = 5;
repeated int32 sortFuncId = 6;
optional bool magmaTable = 7 [default = false];
repeated int32 magmaMap = 8;
optional int32 rangeNum = 9 [default = 0]; // magma range num
}
// Sink
message UnivPlanSink {
required UnivPlanPlanNode super = 1;
required UNIVPLANCONNECTORTYPE connectorType = 2;
required int32 sourceStageNo = 3;
required int32 currentStageNo = 4;
repeated int32 colIdx = 5;
repeated int32 sortFuncId = 6;
}
// Converge
message UnivPlanConverge {
required UnivPlanPlanNode super = 1;
required int32 targetStageNo = 2;
required int32 currentStageNo = 3;
}
// Broadcast
message UnivPlanBroadcast {
required UnivPlanPlanNode super = 1;
required int32 targetStageNo = 2;
required int32 currentStageNo = 3;
}
// Shuffle
message UnivPlanShuffle {
required UnivPlanPlanNode super = 1;
required int32 targetStageNo = 2;
required int32 currentStageNo = 3;
repeated UnivPlanExprPoly hashExpr = 4;
optional bool magmaTable = 5 [default = false];
repeated int32 magmaMap = 6;
optional int32 rangeNum = 9 [default = 0]; // magma range num
}
///////////////////////////////////////////////////////////////////////////////
// SINK NODES END
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
// JOIN NODES BEGIN
///////////////////////////////////////////////////////////////////////////////
enum UNIVPLANJOINTYPE {
JOIN_INNER = 0; // matching tuple pairs only
JOIN_LEFT = 1; // pairs + unmatched LHS tuples
JOIN_RIGHT = 2; // pairs + unmatched RHS tuples
JOIN_FULL = 3; // pairs + unmatched LHS + unmatched RHS
JOIN_IN = 4;
JOIN_LASJ = 8;
JOIN_LASJ_NOTIN = 9;
JOIN_NOT_SUPPORTED = 10;
}
// NestLoop
message UnivPlanNestLoop {
required UnivPlanPlanNode super = 1;
required UNIVPLANJOINTYPE type = 2;
repeated UnivPlanExprPoly joinQual = 3;
}
// HashJoin
message UnivPlanHashJoin {
required UnivPlanPlanNode super = 1;
required UNIVPLANJOINTYPE type = 2;
repeated UnivPlanExprPoly joinQual = 3;
repeated UnivPlanExprPoly hashClauses = 4;
repeated UnivPlanExprPoly hashQualClauses = 5;
}
// MergeJoin
message UnivPlanMergeJoin {
required UnivPlanPlanNode super = 1;
required UNIVPLANJOINTYPE type = 2;
repeated UnivPlanExprPoly joinQual = 3;
repeated UnivPlanExprPoly mergeClauses = 4;
}
///////////////////////////////////////////////////////////////////////////////
// JOIN NODES END
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
// OTHER PLAN NODES BEGIN
///////////////////////////////////////////////////////////////////////////////
message UnivPlanAgg {
required UnivPlanPlanNode super = 1;
required int64 numGroups = 2;
repeated int32 groupColIndexes = 3;
}
message UnivPlanLimit {
required UnivPlanPlanNode super = 1;
optional UnivPlanExprPoly limitOffset = 2;
optional UnivPlanExprPoly limitCount = 3;
}
message UnivPlanAppend {
required UnivPlanPlanNode super = 1;
repeated UnivPlanPlanNodePoly appendPlans = 2;
}
message UnivPlanSort {
required UnivPlanPlanNode super = 1;
repeated int32 colIdx = 2;
repeated int32 sortFuncId = 3;
optional UnivPlanExprPoly limitOffset = 4;
optional UnivPlanExprPoly limitCount = 5;
}
enum UNIVPLANSHARETYPE {
SHARE_NOTSHARED = 0;
SHARE_MATERIAL = 1;
SHARE_MATERIAL_XSLICE = 2;
SHARE_SORT = 3;
SHARE_SORT_XSLICE = 4;
SHARE_NOT_SUPPORTED = 5;
}
message UnivPlanMaterial {
required UnivPlanPlanNode super = 1;
required UNIVPLANSHARETYPE share_type = 2;
required bool cdbStrict = 3;
optional int32 shared_id = 4;
optional int32 driver_slice = 5; // slice id that will execute this material
optional int32 nsharer = 6; // number of sharer
optional int32 nsharer_xslice = 7; // number of sharer cross slice
}
message UnivPlanShareInputScan {
required UnivPlanPlanNode super = 1;
required UNIVPLANSHARETYPE shareType = 2;
required int32 sharedId = 3;
required int32 driverSlice = 4;
}
message UnivPlanResult {
required UnivPlanPlanNode super = 1;
repeated UnivPlanExprPoly resconstantqual = 2;
}
message UnivPlanHash {
required UnivPlanPlanNode super = 1;
}
message UnivPlanSubqueryScan {
required UnivPlanPlanNode super = 1;
optional UnivPlanPlanNodePoly subPlan = 2;
}
message UnivPlanUnique {
required UnivPlanPlanNode super = 1;
repeated int32 uniqColIdxs = 2;
}
message UnivPlanInsert {
required UnivPlanPlanNode super = 1;
required uint32 relId = 2;
}
///////////////////////////////////////////////////////////////////////////////
// OTHER PLAN NODES END
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
// MAGMA NODES BEGIN
///////////////////////////////////////////////////////////////////////////////
enum ExternalScanType {
TableScan = 0;
MagmaIndexScan = 1;
MagmaIndexOnlyScan = 2;
MagmaBitmapScan = 3;
}
enum ExternalScanDirection {
BackwardScanDirection = -1;
NoMovementScanDirection = 0;
ForwardScanDirection = 1;
}
message UnivPlanExtGSScan {
required UnivPlanPlanNode super = 1;
required uint32 relId = 2; // table def index
repeated int32 keyColIndex = 3; // this two field for schema mapping
repeated int32 valColIndex = 4;
repeated int32 columnsToRead = 5;
optional UnivPlanExprPoly filter = 6; // filter
repeated UnivPlanExprPoly filterByKeyCol = 7; // filter for each col
repeated UnivPlanScanTask tasks = 8; // use univplan scan task
// index scan info for magma
optional bool indexscan = 9 [default = false];
optional ExternalScanType type = 10;
optional ExternalScanDirection direction = 11;
optional string indexName = 12;
repeated UnivPlanExprPoly indexQual = 13;
optional bool readStatsOnly = 14 [default = false];
}
message UnivPlanExtGSFilter {
required UnivPlanPlanNode super = 1;
optional UnivPlanExprPoly filter = 2; // filter for all columns
}
message UnivPlanExtGSProj {
required UnivPlanPlanNode super = 1;
repeated int32 columnIndexes = 2; // required columns
}
///////////////////////////////////////////////////////////////////////////////
// MAGMA NODES END
///////////////////////////////////////////////////////////////////////////////
message UnivPlanRangeTblEntry {
required UnivPlanTable table = 1;
}
message UnivPlanListener {
required string address = 1;
required int32 port = 2;
}
message UnivPlanReceiver {
repeated UnivPlanListener listener = 1;
}
message UnivPlanParamInfo {
required int32 type = 1;
required bool isNull = 2;
optional string value = 3;
}
message UnivPlanTokenKey {
required string protocol = 1;
required string ip = 2;
required int32 port = 3;
}
message UnivPlanTokenEntry {
required UnivPlanTokenKey key = 1;
required string token = 2;
}
enum UNIVPLANCMDTYPE {
CMD_UNKNOWN = 0;
CMD_SELECT = 1;
CMD_UPDATE = 2;
CMD_INSERT = 3;
CMD_DELETE = 4;
CMD_UTILITY = 5;
CMD_NOTHING = 6;
}
// Overall container of one plan to execute
message UnivPlanPlan {
required UnivPlanPlanNodePoly plan = 1;
repeated UnivPlanPlan childStages = 2;
repeated UnivPlanRangeTblEntry rangeTables = 3;
repeated UnivPlanReceiver receivers = 4;
optional int32 stageNo = 5;
optional bool doInstrument = 6;
repeated UnivPlanPlanNodePoly subplans = 7;
repeated UnivPlanParamInfo paramInfos = 8;
optional int32 nCrossLevelParams = 9 [default = 0];
repeated UnivPlanTokenEntry tokenMap = 10;
optional bytes snapshot = 11;
map<string, string> guc = 12;
map<string, string> commonValue = 13;
optional UNIVPLANCMDTYPE cmdType = 14 [default = CMD_SELECT];
}