github.com/insionng/yougam@v0.0.0-20170714101924-2bc18d833463/libraries/pingcap/tipb/proto/select.proto (about)

     1  syntax = "proto2";
     2  
     3  package tipb;
     4  
     5  option java_multiple_files = true;
     6  option java_package = "com.pingcap.tidb.tipb";
     7  
     8  import "expression.proto";
     9  import "schema.proto";
    10  
    11  // KeyRange is the encoded index key range, low is closed, high is open. (low <= x < high)
    12  message KeyRange {
    13  	optional bytes low = 1;
    14  	optional bytes high = 2;
    15  }
    16  
    17  // ByItem type for group by and order by.
    18  message ByItem {
    19  	optional Expr expr = 1;
    20  	optional bool desc = 2;
    21  }
    22  
    23  // SelectRequest works like a simplified select statement.
    24  message SelectRequest {
    25  	// transaction start timestamp.
    26  	optional uint64 start_ts = 1;
    27  
    28  	// If table_info is not null, it represents a table scan, index_info would be null.
    29  	optional TableInfo table_info = 2;
    30  
    31  	// If index_info is not null, it represents an index scan, table_info would be null.
    32  	optional IndexInfo index_info = 3;
    33  
    34  	// fields to be selected, fields type can be column reference for simple scan.
    35  	// or aggregation function. If no fields specified, only handle will be returned.
    36  	repeated Expr fields = 4;
    37  
    38  	// disjoint handle ranges to be scanned.
    39  	repeated KeyRange ranges = 5;
    40  
    41  	// distinct result.
    42  	optional bool distinct = 6;
    43  
    44  	// where condition.
    45  	optional Expr where = 7;
    46  
    47  	// group by clause.
    48  	repeated ByItem group_by = 8;
    49  
    50  	// having clause.
    51  	optional Expr having = 9;
    52  
    53  	// order by clause.
    54  	repeated ByItem order_by = 10;
    55  
    56  	// limit the result to be returned.
    57  	optional int64 limit = 12;
    58  }
    59  
    60  // values are all in text format.
    61  message Row {
    62  	optional bytes handle = 1;
    63  	optional bytes data = 2;
    64  }
    65  
    66  message Error {
    67  	optional int32 code = 1;
    68  	optional string msg = 2;
    69  }
    70  
    71  // Response for SelectRequest.
    72  message SelectResponse {
    73  	optional Error error = 1;
    74  
    75  	// Result rows.
    76  	repeated Row rows = 2;
    77  }