@@ -2,175 +2,173 @@ syntax = "proto2";
22
33package tipb ;
44
5- option java_multiple_files = true ;
6- option java_package = "com.pingcap.tidb.tipb" ;
7-
8- import "schema.proto" ;
9-
105import "gogoproto/gogo.proto" ;
116import "rustproto.proto" ;
7+ import "schema.proto" ;
128
9+ option java_multiple_files = true ;
10+ option java_package = "com.pingcap.tidb.tipb" ;
11+ option (gogoproto.goproto_sizecache_all ) = false ;
12+ option (gogoproto.goproto_unkeyed_all ) = false ;
13+ option (gogoproto.goproto_unrecognized_all ) = false ;
1314option (gogoproto.marshaler_all ) = true ;
1415option (gogoproto.sizer_all ) = true ;
1516option (gogoproto.unmarshaler_all ) = true ;
16- option (gogoproto.goproto_unkeyed_all ) = false ;
17- option (gogoproto.goproto_unrecognized_all ) = false ;
18- option (gogoproto.goproto_sizecache_all ) = false ;
1917option (rustproto.lite_runtime_all ) = true ;
2018
2119enum AnalyzeType {
22- TypeIndex = 0 ;
23- TypeColumn = 1 ;
24- TypeCommonHandle = 2 ;
25- TypeSampleIndex = 3 ;
26- TypeMixed = 4 ;
27- TypeFullSampling = 5 ;
20+ TypeIndex = 0 ;
21+ TypeColumn = 1 ;
22+ TypeCommonHandle = 2 ;
23+ TypeSampleIndex = 3 ;
24+ TypeMixed = 4 ;
25+ TypeFullSampling = 5 ;
2826}
2927
3028message AnalyzeReq {
31- optional AnalyzeType tp = 1 [(gogoproto.nullable ) = false ];
32- // Deprecated. Start Ts has been moved to coprocessor.Request.
33- optional uint64 start_ts_fallback = 2 ;
34- optional uint64 flags = 3 [(gogoproto.nullable ) = false ];
35- optional int64 time_zone_offset = 4 [(gogoproto.nullable ) = false ];
36- optional AnalyzeIndexReq idx_req = 5 ;
37- optional AnalyzeColumnsReq col_req = 6 ;
29+ optional AnalyzeType tp = 1 [(gogoproto.nullable ) = false ];
30+ // Deprecated. Start Ts has been moved to coprocessor.Request.
31+ optional uint64 start_ts_fallback = 2 ;
32+ optional uint64 flags = 3 [(gogoproto.nullable ) = false ];
33+ optional int64 time_zone_offset = 4 [(gogoproto.nullable ) = false ];
34+ optional AnalyzeIndexReq idx_req = 5 ;
35+ optional AnalyzeColumnsReq col_req = 6 ;
3836}
3937
4038message AnalyzeIndexReq {
41- // bucket_size is the max histograms bucket size.
42- optional int64 bucket_size = 1 [(gogoproto.nullable ) = false ];
39+ // bucket_size is the max histograms bucket size.
40+ optional int64 bucket_size = 1 [(gogoproto.nullable ) = false ];
4341
44- // num_columns is the number of columns in the index.
45- optional int32 num_columns = 2 [(gogoproto.nullable ) = false ];
42+ // num_columns is the number of columns in the index.
43+ optional int32 num_columns = 2 [(gogoproto.nullable ) = false ];
4644
47- optional int32 cmsketch_depth = 3 ;
45+ optional int32 cmsketch_depth = 3 ;
4846
49- optional int32 cmsketch_width = 4 ;
47+ optional int32 cmsketch_width = 4 ;
5048
51- optional int64 sample_size = 5 [(gogoproto.nullable ) = false ];
49+ optional int64 sample_size = 5 [(gogoproto.nullable ) = false ];
5250
53- optional int64 sketch_size = 6 [(gogoproto.nullable ) = false ];
51+ optional int64 sketch_size = 6 [(gogoproto.nullable ) = false ];
5452
55- optional int32 top_n_size = 7 ;
53+ optional int32 top_n_size = 7 ;
5654
57- optional int32 version = 8 ;
55+ optional int32 version = 8 ;
5856}
5957
6058message AnalyzeColumnsReq {
61- // bucket_size is the max histograms bucket size, we need this because when primary key is handle,
62- // the histogram will be directly built.
63- optional int64 bucket_size = 1 [(gogoproto.nullable ) = false ];
59+ // bucket_size is the max histograms bucket size, we need this because when primary key is handle,
60+ // the histogram will be directly built.
61+ optional int64 bucket_size = 1 [(gogoproto.nullable ) = false ];
6462
65- // sample_size is the max number of samples that will be collected.
66- optional int64 sample_size = 2 [(gogoproto.nullable ) = false ];
63+ // sample_size is the max number of samples that will be collected.
64+ optional int64 sample_size = 2 [(gogoproto.nullable ) = false ];
6765
68- // sketch_size is the max sketch size.
69- optional int64 sketch_size = 3 [(gogoproto.nullable ) = false ];
66+ // sketch_size is the max sketch size.
67+ optional int64 sketch_size = 3 [(gogoproto.nullable ) = false ];
7068
71- // columns_info is the info of all the columns that needs to be analyzed.
72- repeated ColumnInfo columns_info = 4 ;
69+ // columns_info is the info of all the columns that needs to be analyzed.
70+ repeated ColumnInfo columns_info = 4 ;
7371
74- optional int32 cmsketch_depth = 5 ;
72+ optional int32 cmsketch_depth = 5 ;
7573
76- optional int32 cmsketch_width = 6 ;
74+ optional int32 cmsketch_width = 6 ;
7775
78- repeated int64 primary_column_ids = 7 ;
76+ repeated int64 primary_column_ids = 7 ;
7977
80- optional int32 version = 8 ;
78+ optional int32 version = 8 ;
8179
82- repeated int64 primary_prefix_column_ids = 9 ;
80+ repeated int64 primary_prefix_column_ids = 9 ;
8381
84- repeated AnalyzeColumnGroup column_groups = 10 ;
85- // sample_rate is the sampling rate that how many samples will collected.
86- // There must be one non-zero value in sample_rate and sample_size.
87- optional double sample_rate = 11 ;
82+ repeated AnalyzeColumnGroup column_groups = 10 ;
83+ // sample_rate is the sampling rate that how many samples will collected.
84+ // There must be one non-zero value in sample_rate and sample_size.
85+ optional double sample_rate = 11 ;
8886}
8987
9088message AnalyzeMixedResp {
91- optional AnalyzeColumnsResp columns_resp = 1 ;
89+ optional AnalyzeColumnsResp columns_resp = 1 ;
9290
93- optional AnalyzeIndexResp index_resp = 2 ;
91+ optional AnalyzeIndexResp index_resp = 2 ;
9492}
9593
9694message AnalyzeColumnGroup {
97- repeated int64 column_offsets = 1 ;
98- repeated int64 prefix_lengths = 2 ;
95+ repeated int64 column_offsets = 1 ;
96+ repeated int64 prefix_lengths = 2 ;
9997}
10098
10199message AnalyzeColumnsResp {
102- // collectors is the sample collectors for columns.
103- repeated SampleCollector collectors = 1 ;
100+ // collectors is the sample collectors for columns.
101+ repeated SampleCollector collectors = 1 ;
104102
105- // pk_hist is the histogram for primary key when it is the handle.
106- optional Histogram pk_hist = 2 ;
103+ // pk_hist is the histogram for primary key when it is the handle.
104+ optional Histogram pk_hist = 2 ;
107105
108- optional RowSampleCollector row_collector = 3 ;
106+ optional RowSampleCollector row_collector = 3 ;
109107}
110108
111109message AnalyzeIndexResp {
112- optional Histogram hist = 1 ;
113- optional CMSketch cms = 2 ;
114- optional SampleCollector collector = 3 ;
110+ optional Histogram hist = 1 ;
111+ optional CMSketch cms = 2 ;
112+ optional SampleCollector collector = 3 ;
115113}
116114
117115// Bucket is an element of histogram.
118116message Bucket {
119- optional int64 count = 1 [(gogoproto.nullable ) = false ];
120- optional bytes lower_bound = 2 ;
121- optional bytes upper_bound = 3 ;
122- optional int64 repeats = 4 [(gogoproto.nullable ) = false ];
123- optional int64 ndv = 5 ;
117+ optional int64 count = 1 [(gogoproto.nullable ) = false ];
118+ optional bytes lower_bound = 2 ;
119+ optional bytes upper_bound = 3 ;
120+ optional int64 repeats = 4 [(gogoproto.nullable ) = false ];
121+ optional int64 ndv = 5 ;
124122}
125123
126124message Histogram {
127- // ndv is the number of distinct values.
128- optional int64 ndv = 1 [(gogoproto.nullable ) = false ];
125+ // ndv is the number of distinct values.
126+ optional int64 ndv = 1 [(gogoproto.nullable ) = false ];
129127
130- // buckets represents all the buckets.
131- repeated Bucket buckets = 2 ;
128+ // buckets represents all the buckets.
129+ repeated Bucket buckets = 2 ;
132130}
133131
134132// FMSketch is used to count distinct values for columns.
135133message FMSketch {
136- optional uint64 mask = 1 [(gogoproto.nullable ) = false ];
137- repeated uint64 hashset = 2 ;
134+ optional uint64 mask = 1 [(gogoproto.nullable ) = false ];
135+ repeated uint64 hashset = 2 ;
138136}
139137
140138// SampleCollector is used for collect samples and calculate the count and ndv of an column.
141139message SampleCollector {
142- repeated bytes samples = 1 ;
143- optional int64 null_count = 2 [(gogoproto.nullable ) = false ];
144- optional int64 count = 3 [(gogoproto.nullable ) = false ];
145- optional FMSketch fm_sketch = 4 ;
146- optional CMSketch cm_sketch = 5 ;
147- optional int64 total_size = 6 ;
140+ repeated bytes samples = 1 ;
141+ optional int64 null_count = 2 [(gogoproto.nullable ) = false ];
142+ optional int64 count = 3 [(gogoproto.nullable ) = false ];
143+ optional FMSketch fm_sketch = 4 ;
144+ optional CMSketch cm_sketch = 5 ;
145+ optional int64 total_size = 6 ;
148146}
149147
150148message RowSampleCollector {
151- repeated RowSample samples = 1 ;
152- repeated int64 null_counts = 2 [(gogoproto.nullable ) = false ];
153- optional int64 count = 3 [(gogoproto.nullable ) = false ];
154- repeated FMSketch fm_sketch = 4 ;
155- repeated int64 total_size = 5 ;
149+ repeated RowSample samples = 1 ;
150+ repeated int64 null_counts = 2 [(gogoproto.nullable ) = false ];
151+ optional int64 count = 3 [(gogoproto.nullable ) = false ];
152+ repeated FMSketch fm_sketch = 4 ;
153+ repeated int64 total_size = 5 ;
156154}
157155
158156message RowSample {
159- repeated bytes row = 1 ;
160- optional int64 weight = 2 [(gogoproto.nullable ) = false ];
157+ repeated bytes row = 1 ;
158+ optional int64 weight = 2 [(gogoproto.nullable ) = false ];
161159}
162160
163161message CMSketchRow {
164- repeated uint32 counters = 1 ;
162+ repeated uint32 counters = 1 ;
165163}
166164
167165message CMSketchTopN {
168- optional bytes data = 1 ;
169- optional uint64 count = 2 [(gogoproto.nullable ) = false ];
166+ optional bytes data = 1 ;
167+ optional uint64 count = 2 [(gogoproto.nullable ) = false ];
170168}
171169
172170message CMSketch {
173- repeated CMSketchRow rows = 1 ;
174- repeated CMSketchTopN top_n = 2 ;
175- optional uint64 default_value = 3 [(gogoproto.nullable ) = false ];
171+ repeated CMSketchRow rows = 1 ;
172+ repeated CMSketchTopN top_n = 2 ;
173+ optional uint64 default_value = 3 [(gogoproto.nullable ) = false ];
176174}
0 commit comments