github.com/matrixorigin/matrixone@v1.2.0/proto/pipeline.proto (about)

     1  /* 
     2   * Copyright 2021 Matrix Origin
     3   *
     4   * Licensed under the Apache License, Version 2.0 (the "License");
     5   * you may not use this file except in compliance with the License.
     6   * You may obtain a copy of the License at
     7   *
     8   *      http://www.apache.org/licenses/LICENSE-2.0
     9   *
    10   * Unless required by applicable law or agreed to in writing, software
    11   * distributed under the License is distributed on an "AS IS" BASIS,
    12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13   * See the License for the specific language governing permissions and
    14   * limitations under the License.
    15   */
    16  
    17  syntax = "proto3";
    18  package pipeline;
    19  
    20  import "github.com/gogo/protobuf/gogoproto/gogo.proto";
    21  option go_package = "github.com/matrixorigin/matrixone/pkg/pb/pipeline";
    22  option (gogoproto.sizer_all) = false;
    23  option (gogoproto.protosizer_all) = true;
    24  
    25  import "plan.proto";
    26  import "timestamp.proto";
    27  import "lock.proto";
    28  
    29  enum Method {
    30      UnknownMethod = 0;
    31      PipelineMessage = 1;
    32      BatchMessage = 2;
    33      PrepareDoneNotifyMessage = 3;// for dispatch
    34  }
    35  
    36  enum Status {
    37      UnknownStatus = 0;
    38      WaitingNext = 1;
    39      Last = 2;
    40      MessageEnd = 3;
    41  }
    42  
    43  message Message {
    44    Status  sid = 1;
    45    Method  cmd = 2;
    46    bytes   err = 3;
    47    bytes   data = 4;
    48    bytes   proc_info_data = 5;
    49    bytes   analyse = 6;
    50    uint64  id = 7;
    51    bytes   uuid = 8;
    52    uint64  batch_cnt = 9;
    53    uint32  checksum = 10;
    54    uint64  sequence = 11;
    55  }
    56  
    57  message Connector {
    58    int32 pipeline_id = 1;
    59    int32 connector_index = 2;
    60  }
    61  
    62  message Shuffle{
    63    int32 ShuffleColIdx=1;
    64    int32 ShuffleType = 2;
    65    int64 ShuffleColMin = 3;
    66    int64 ShuffleColMax = 4;
    67    int32 AliveRegCnt = 5;
    68    repeated uint64 shuffle_ranges_uint64 = 6;
    69    repeated int64 shuffle_ranges_int64=7;
    70  }
    71  
    72  message Dispatch {
    73    int32 func_id = 1;
    74    repeated Connector local_connector = 2;
    75    repeated WrapNode remote_connector = 3;
    76    repeated int32 shuffle_reg_idx_local=4;
    77    repeated int32 shuffle_reg_idx_remote=5;
    78    int32 shuffle_type=6;
    79    bool  is_sink = 7;
    80    bool  rec_sink = 8;
    81  }
    82  
    83  message Merge {
    84    bool sinkScan = 1;
    85  }
    86  
    87  message MultiArguemnt{
    88    bool Dist = 1;
    89    repeated plan.Expr GroupExpr = 2;
    90    repeated plan.Expr OrderByExpr = 3;
    91    string Separator = 4;
    92    int32 OrderId = 5;
    93  }
    94  
    95  message Aggregate {
    96    int64 op = 1;
    97    bool dist = 2;
    98    repeated plan.Expr expr = 3;
    99    bytes config =4;
   100  }
   101  
   102  message Group {
   103    bool need_eval = 1;
   104    uint64 ibucket = 2;
   105    uint64 nbucket = 3;
   106    repeated plan.Expr  exprs = 4;
   107    repeated plan.Type  types = 5 [(gogoproto.nullable) = false];
   108    repeated Aggregate  aggs = 6;
   109    repeated MultiArguemnt MultiAggs = 7;
   110    bool isShuffle = 8;
   111    uint64 preAllocSize = 9;
   112    bytes PartialResults = 11;
   113    repeated uint32 PartialResultTypes = 10;
   114  }
   115  
   116  message Insert{
   117    uint64 affected              = 1;
   118    bool ToWriteS3 = 2;
   119    bool add_affected_rows       = 3;
   120    plan.ObjectRef ref           = 4;
   121    repeated string attrs        = 5;
   122    // Align array index with the partition number
   123    repeated uint64 partition_table_ids = 6;
   124    repeated string partition_table_names = 7;
   125    int32 partition_idx = 8;
   126    bool is_end         = 9;
   127    plan.TableDef table_def = 10;
   128  }
   129  
   130  message Array{
   131    repeated int32 array = 1;
   132  }
   133  
   134  message Map{
   135    map<string, int32> mp = 1;
   136  }
   137  
   138  message Deletion{
   139    uint64 AffectedRows = 1;
   140    bool RemoteDelete = 2;
   141    uint32 IBucket = 3;
   142    uint32 NBucket = 4;
   143    // DeleteCtx
   144  
   145    int32 row_id_idx                      = 5;
   146    repeated uint64 partition_table_ids   = 6;
   147    repeated string partition_table_names = 7;
   148    int32 partition_index_in_batch        = 8;
   149    plan.ObjectRef ref                    = 9;
   150    bool add_affected_rows                = 10;
   151    map<string,int32> SegmentMap          = 11;
   152    bool can_truncate                     = 12;
   153    bool is_end                           = 13;
   154    int32 primary_key_idx                 = 14;
   155  }
   156  
   157  message PreInsert {
   158    string schema_name         = 1;
   159    plan.TableDef table_def    = 2;
   160    repeated int32 idx         = 3;
   161    repeated string attrs      = 4;
   162    bool has_auto_col          = 5;
   163    bool is_update             = 6;
   164    int64 estimated_row_count  = 7;
   165  }
   166  
   167  message LockTarget {
   168    uint64 table_id           	  = 1;
   169    int32 primary_col_idx_in_bat  = 2;
   170    plan.Type primary_col_typ     = 3 [(gogoproto.nullable) = false];
   171    int32 refresh_ts_idx_in_bat   = 4;
   172    int32 filter_col_idx_in_bat   = 5;
   173    bool lock_table               = 6;
   174    bool ChangeDef               = 7;
   175    lock.LockMode Mode         = 8;
   176  }
   177  
   178  message LockOp {
   179    repeated LockTarget targets = 1;
   180    bool                block   = 2;
   181  }
   182  
   183  message PreInsertUnique {
   184    plan.PreInsertUkCtx pre_insert_uk_ctx = 1;
   185  }
   186  
   187  message PreInsertSecondaryIndex{
   188    plan.PreInsertUkCtx pre_insert_sk_ctx = 1;
   189  }
   190  
   191  message OnDuplicateKey{
   192    repeated string attrs = 1;
   193    int32 insert_col_count = 2;
   194    repeated plan.Expr unique_col_check_expr = 3;
   195    repeated string unique_cols = 4;
   196    repeated int32 on_duplicate_idx		= 5;
   197    map<string, plan.Expr> on_duplicate_expr	= 6;
   198    bool is_ignore 						= 7;
   199  }
   200  
   201  message FuzzyFilter {
   202    float N = 1;
   203    string PkName = 2;
   204    plan.Type PkTyp = 3 [(gogoproto.nullable) = false];
   205  }
   206  
   207  message Join {
   208    repeated int32 rel_list = 1;
   209    repeated int32 col_list = 2;
   210    plan.Expr  expr = 3;
   211    repeated plan.Type  types = 4 [(gogoproto.nullable) = false];
   212    repeated plan.Expr left_cond = 5;
   213    repeated plan.Expr right_cond = 6;
   214    repeated plan.RuntimeFilterSpec runtime_filter_build_list = 7;
   215    bool hash_on_pk = 8;
   216    bool is_shuffle =9;
   217  }
   218  
   219  message AntiJoin{
   220    repeated int32 result = 1;
   221    plan.Expr  expr = 2;
   222    repeated plan.Type  types = 3 [(gogoproto.nullable) = false];
   223    repeated plan.Expr left_cond = 4;
   224    repeated plan.Expr right_cond = 5;
   225    bool hash_on_pk = 6;
   226    bool is_shuffle = 7;
   227  }
   228  
   229  message LeftJoin {
   230    repeated int32 rel_list = 1;
   231    repeated int32 col_list = 2;
   232    plan.Expr  expr = 3;
   233    repeated plan.Type  types = 4 [(gogoproto.nullable) = false];
   234    repeated plan.Expr left_cond = 5;
   235    repeated plan.Expr right_cond = 6;
   236    repeated plan.RuntimeFilterSpec runtime_filter_build_list = 7;
   237    bool hash_on_pk = 8;
   238    bool is_shuffle = 9;
   239  }
   240  
   241  message RightJoin {
   242    repeated int32 rel_list = 1;
   243    repeated int32 col_list = 2;
   244    plan.Expr  expr = 3;
   245    repeated plan.Type  left_types = 4 [(gogoproto.nullable) = false];
   246    repeated plan.Type  right_types = 5 [(gogoproto.nullable) = false];
   247    repeated plan.Expr left_cond = 6;
   248    repeated plan.Expr right_cond = 7;
   249    repeated plan.RuntimeFilterSpec runtime_filter_build_list = 8;
   250    bool hash_on_pk = 9;
   251    bool is_shuffle = 10;
   252  }
   253  
   254  message RightSemiJoin {
   255    repeated int32 result = 1;
   256    plan.Expr  expr = 2;
   257    repeated plan.Type right_types = 3 [(gogoproto.nullable) = false];
   258    repeated plan.Expr left_cond = 4;
   259    repeated plan.Expr right_cond = 5;
   260    repeated plan.RuntimeFilterSpec runtime_filter_build_list = 6;
   261    bool hash_on_pk = 7;
   262    bool is_shuffle = 8;
   263  }
   264  
   265  message RightAntiJoin {
   266    repeated int32 result = 1;
   267    plan.Expr  expr = 2;
   268    repeated plan.Type right_types = 3 [(gogoproto.nullable) = false];
   269    repeated plan.Expr left_cond = 4;
   270    repeated plan.Expr right_cond = 5;
   271    repeated plan.RuntimeFilterSpec runtime_filter_build_list = 6;
   272    bool hash_on_pk = 7;
   273    bool is_shuffle = 8;
   274  }
   275  
   276  message SemiJoin {
   277    repeated int32 result = 1;
   278    plan.Expr  expr = 2;
   279    repeated plan.Type  types = 3 [(gogoproto.nullable) = false];
   280    repeated plan.Expr left_cond = 4;
   281    repeated plan.Expr right_cond = 5;
   282    repeated plan.RuntimeFilterSpec runtime_filter_build_list = 6;
   283    bool hash_on_pk = 7;
   284    bool is_shuffle = 8;
   285  }
   286  
   287  message SingleJoin {
   288    repeated int32 rel_list = 1;
   289    repeated int32 col_list = 2;
   290    plan.Expr  expr = 3;
   291    repeated plan.Type  types = 4 [(gogoproto.nullable) = false];
   292    repeated plan.Expr left_cond = 5;
   293    repeated plan.Expr right_cond = 6;
   294    repeated plan.RuntimeFilterSpec runtime_filter_build_list = 7;
   295    bool hash_on_pk = 8;
   296    bool is_shuffle = 9;
   297  }
   298  
   299  message MarkJoin {
   300    repeated int32 result = 1;
   301    plan.Expr expr = 2;
   302    repeated plan.Type types = 3 [(gogoproto.nullable) = false];
   303    repeated plan.Expr left_cond = 4;
   304    repeated plan.Expr right_cond = 5;
   305    repeated plan.Expr on_list = 6;
   306    bool hash_on_pk = 7;
   307    bool is_shuffle = 8;
   308  }
   309  
   310  message Product {
   311    repeated int32 rel_list = 1;
   312    repeated int32 col_list = 2;
   313    repeated plan.Type  types = 3 [(gogoproto.nullable) = false];
   314    bool is_shuffle =4;
   315  }
   316  
   317  message IndexJoin {
   318    repeated int32 result = 1;
   319    repeated plan.Type  types = 2 [(gogoproto.nullable) = false];
   320    repeated plan.RuntimeFilterSpec runtime_filter_build_list = 3;
   321  }
   322  
   323  message TableFunction {
   324    repeated string attrs = 1;
   325    repeated plan.ColDef rets = 2;
   326    repeated plan.Expr args = 3;
   327    bytes params = 4;
   328    string name = 5;
   329  }
   330  
   331  message HashBuild {
   332    bool need_expr = 1;
   333    bool need_hash = 2;
   334    uint64 ibucket = 3;
   335    uint64 nbucket = 4;
   336    repeated plan.Type types = 5 [(gogoproto.nullable) = false];
   337    repeated plan.Expr conds = 6;
   338    bool hash_on_pk = 7;
   339    bool need_merged_batch = 8;
   340    bool need_allocate_sels = 9;
   341  }
   342  
   343  message ExternalName2ColIndex {
   344    string name = 1;
   345    int32 index = 2;
   346  }
   347  
   348  message file_offset {
   349    repeated int64 offset = 1;
   350  }
   351  
   352  message ExternalScan {
   353    repeated string attrs = 1;
   354    repeated int64 file_size = 2;
   355    repeated file_offset file_offset_total = 3;
   356    repeated plan.ColDef cols = 4;
   357    repeated ExternalName2ColIndex name2_col_index = 5;
   358    string create_sql = 6;
   359    repeated string file_list = 7;
   360    repeated plan.ColDef origin_cols = 8;
   361    plan.Expr    filter = 9;
   362  }
   363  
   364  message StreamScan {
   365    plan.TableDef tbl_def = 1;
   366    int64 offset = 2;
   367    int64 limit = 3;
   368  }
   369  
   370  message SampleFunc {
   371    enum SampleType {
   372      Rows = 0;
   373      Percent = 1;
   374      MergeRows = 2;
   375    }
   376    SampleType sample_type = 1;
   377    int32 sample_rows = 2;
   378    double sample_percent = 3;
   379    repeated plan.Expr sample_columns = 4;
   380  }
   381  
   382  message Instruction{
   383    // Op specified the operator code of an instruction.
   384    int32 op = 1;
   385    // Idx specified the anaylze information index.
   386    int32 idx = 2;
   387    AntiJoin  anti = 3;
   388    Connector   connect = 4;
   389    Dispatch  dispatch = 5;
   390    Group     agg = 6;
   391    LeftJoin  left_join = 8;
   392    SemiJoin  semi_join = 9;
   393    SingleJoin single_join = 10;
   394    MarkJoin    mark_join = 11;
   395    Join    join = 12;
   396    Product    product = 13;
   397    TableFunction table_function = 14;
   398    HashBuild hash_build = 15;
   399    ExternalScan external_scan = 16;
   400    Insert insert = 17;
   401    OnDuplicateKey on_duplicate_key = 18;
   402    PreInsert pre_insert               = 19;
   403    PreInsertUnique pre_insert_unique  = 20;
   404    repeated plan.OrderBySpec order_by = 21;
   405    repeated plan.Expr    project_list = 22;
   406    plan.Expr    filter = 23;
   407    uint64    limit = 24;
   408    uint64    offset = 25;
   409    // isFirst identifies whether it is the first instruction of analyzeInfo corresponding to idx
   410    bool isFirst = 26;
   411    // isLast identifies whether it is the last instruction of analyzeInfo corresponding to idx
   412    bool isLast = 27;
   413    
   414    RightJoin right_join = 28;
   415    RightSemiJoin right_semi_join = 29;
   416    RightAntiJoin right_anti_join = 30;
   417  
   418    Deletion delete = 31;
   419    LockOp lock_op = 32;
   420    Shuffle shuffle = 33;
   421    Merge merge = 34;
   422    StreamScan stream_scan = 35;
   423    PreInsertSecondaryIndex pre_insert_secondary_index  = 36;
   424    SampleFunc sample_func = 37;
   425    FuzzyFilter fuzzy_filter = 38;
   426  
   427    string cn_addr = 39;
   428    int32 operator_id = 40;
   429    int32 parallel_id = 41;
   430    int32 max_parallel = 42;
   431    IndexJoin index_join = 43;
   432  }
   433  
   434  message AnalysisList {
   435    repeated plan.AnalyzeInfo list = 1;
   436  }
   437  
   438  message Source {
   439    string schema_name = 1;
   440    string table_name = 2;
   441    repeated string col_list = 3;
   442    string    block = 4;
   443    uint64    pushdown_id = 5;
   444    string    pushdown_addr = 6;
   445    plan.Expr  expr = 7;
   446    plan.TableDef tableDef = 8;
   447    timestamp.Timestamp timestamp = 9;
   448    repeated plan.RuntimeFilterSpec runtime_filter_probe_list = 10;
   449  }
   450  
   451  message NodeInfo {
   452    int32 mcpu = 1;
   453    string id = 2;
   454    string addr = 3;
   455    string payload = 4;
   456    uint32 type = 5;
   457  }
   458  
   459  message ProcessLimitation {
   460    int64 size = 1;
   461    int64 batch_rows = 2;
   462    int64 batch_size = 3;
   463    int64 partition_rows = 4;
   464    int64 reader_size = 5;
   465  }
   466  
   467  message ProcessInfo {
   468    string id = 1;
   469    string sql = 2;
   470    ProcessLimitation lim = 3;
   471    int64 unix_time = 4;
   472    uint32 account_id = 5;
   473    string snapshot = 6;
   474    SessionInfo session_info = 7;
   475    repeated int32 analysis_node_list = 8;
   476  }
   477  
   478  message SessionInfo {
   479    string user = 1;
   480    string host = 2;
   481    string role = 3;
   482    uint64 connection_id = 4;
   483    string database = 5;
   484    string version = 6;
   485    bytes  time_zone = 7;
   486    string  account = 8;
   487    repeated string query_id = 9;
   488  }
   489  
   490  message Pipeline {
   491    enum PipelineType{
   492      Merge = 0;
   493      Normal = 1;
   494      Remote = 2;
   495      Parallel = 3;
   496    }
   497  
   498    PipelineType pipeline_type = 1;
   499    int32 pipeline_id = 2;
   500    plan.Plan qry = 3;
   501    Source data_source = 4;
   502    repeated Pipeline children = 5;
   503    repeated Instruction instruction_list = 6;
   504  
   505    bool is_end = 7;
   506    bool is_join = 8;
   507    bool is_load = 9;
   508    NodeInfo node = 10;
   509    int32 push_down_info = 11;
   510    int32 children_count = 12;
   511  
   512    repeated UuidToRegIdx uuids_to_reg_idx = 13;
   513    int32 build_idx = 14;
   514    int32 shuffle_cnt = 15;
   515  }
   516  
   517  message WrapNode {
   518    string node_addr = 1;
   519    bytes uuid = 2;
   520  }
   521  
   522  message UuidToRegIdx {
   523    int32 idx = 1;
   524    bytes uuid = 2;
   525    string from_addr = 3;
   526  }