81 lines
1.7 KiB
Protocol Buffer
81 lines
1.7 KiB
Protocol Buffer
syntax = "proto2";
|
|
|
|
package tipb;
|
|
|
|
option java_multiple_files = true;
|
|
option java_package = "com.pingcap.tidb.tipb";
|
|
|
|
import "expression.proto";
|
|
import "schema.proto";
|
|
|
|
// KeyRange is the encoded index key range, low is closed, high is open. (low <= x < high)
|
|
message KeyRange {
|
|
optional bytes low = 1;
|
|
optional bytes high = 2;
|
|
}
|
|
|
|
// ByItem type for group by and order by.
|
|
message ByItem {
|
|
optional Expr expr = 1;
|
|
optional bool desc = 2;
|
|
}
|
|
|
|
// SelectRequest works like a simplified select statement.
|
|
message SelectRequest {
|
|
// transaction start timestamp.
|
|
optional int64 start_ts = 1;
|
|
|
|
// If table_info is not null, it represents a table scan, index_info would be null.
|
|
optional TableInfo table_info = 2;
|
|
|
|
// If index_info is not null, it represents an index scan, table_info would be null.
|
|
optional IndexInfo index_info = 3;
|
|
|
|
// fields to be selected, fields type can be column reference for simple scan.
|
|
// or aggregation function. If no fields specified, only handle will be returned.
|
|
repeated Expr fields = 4;
|
|
|
|
// disjoint handle ranges to be scanned.
|
|
repeated KeyRange ranges = 5;
|
|
|
|
// distinct result.
|
|
optional bool distinct = 6;
|
|
|
|
// where condition.
|
|
optional Expr where = 7;
|
|
|
|
// group by clause.
|
|
repeated ByItem group_by = 8;
|
|
|
|
// having clause.
|
|
optional Expr having = 9;
|
|
|
|
// order by clause.
|
|
repeated ByItem order_by = 10;
|
|
|
|
// offset of the result.
|
|
optional int64 offset = 11;
|
|
|
|
// limit the result to be returned.
|
|
optional int64 limit = 12;
|
|
}
|
|
|
|
// values are all in text format.
|
|
message Row {
|
|
optional bytes handle = 1;
|
|
optional bytes data = 2;
|
|
}
|
|
|
|
message Error {
|
|
optional int32 code = 1;
|
|
optional string msg = 2;
|
|
}
|
|
|
|
// Response for SelectRequest.
|
|
message SelectResponse {
|
|
optional Error error = 1;
|
|
|
|
// Result rows.
|
|
repeated Row rows = 2;
|
|
}
|