aboutsummaryrefslogtreecommitdiff
path: root/protocol/src/main/protobuf/UserBitShared.proto
blob: 30c612ca3f50e03ac01b775774bcb48b4fcc808b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
package exec.shared;

option java_package = "org.apache.drill.exec.proto";
option java_outer_classname = "UserBitShared";
option optimize_for = SPEED;

import "Types.proto";
import "Coordination.proto";
import "SchemaDef.proto";

enum RpcChannel {
  BIT_CONTROL = 0;
  BIT_DATA = 1;
  USER = 2;
}

enum QueryType {
  SQL = 1;
  LOGICAL = 2;
  PHYSICAL = 3;
  EXECUTION = 4;

  /* Input is a prepared statement */
  PREPARED_STATEMENT = 5;
}

message UserCredentials {
  optional string user_name = 1;
}

message QueryId {
  optional sfixed64 part1 = 1;
  optional sfixed64 part2 = 2;
}

message DrillPBError{
  enum ErrorType {
    /* equivalent to SQLClientInfoException
     * - handshake version error
     * - invalid schema
     */
    CONNECTION = 0;
    /* equivalent to SQLRecoverableException
     * - corrupt files: can't be read. FS read error
     * - parsing error due to incomplete or incorrectly written records
     */
    DATA_READ = 1;
    /* equivalent to SQLDataException
     * - data type unsupported by format
     */
    DATA_WRITE = 2;
    /* equivalent to SQLDataException
     * - Casting errors
     * - function not found for incoming types after implicit casting
     * - Flatten misuse
     */
    FUNCTION = 3;
    /* equivalent to SQLSyntaxErrorException
     * - typos
     * - missing table
     * - SQL keyword misuse
     * - function names/resolution
     */
    PARSE = 4;
    /* equivalent to SQLInvalidAuthorizationSpecException
     */
    PERMISSION = 5;
    /* equivalent to SQLNonTransientException
     */
    PLAN = 6;
    /* equivalent to SQLRecoverableException or SQLTransientException
     * - Recoverable: memory, disk
     * - Transient: network
     */
    RESOURCE = 7;
    /* equivalent to SQLNonTransientException.
     * - unexpected internal state
     * - uncategorized operation
     * general user action is to contact the Drill team for
     * assistance
     */
    SYSTEM = 8;
    /* equivalent to SQLFeatureNotSupportedException
     * - unimplemented feature, option, or execution path
     * - schema change in operator that does not support it
     */
    UNSUPPORTED_OPERATION = 9;
    /* SQL validation exception
     * - invalid schema path
     * - invalid entries in SQL tree
     */
    VALIDATION = 10;
    /* Execution exception
     *  - Internal errors not related to bad code
     */
    EXECUTION_ERROR = 11;
    /* Internal exception
     *  - Failed assertions
     *  - Other "this should not happen" cases
     */
    INTERNAL_ERROR = 12;
    /* Unspecified exception
     *  - Exception caught but cause is unknown
     * Indicates code that needs revisiting to move error reporting
     * closer to the cause.
     */
    UNSPECIFIED_ERROR = 13;
  }
  optional string error_id = 1; // for debug tracing purposes
  optional DrillbitEndpoint endpoint = 2;
  optional ErrorType error_type = 3;
  optional string message = 4;
  optional ExceptionWrapper exception = 5;
  repeated ParsingError parsing_error = 6; //optional, used when providing location of error within a piece of text.
}

message ExceptionWrapper {
  optional string exception_class = 1;
  optional string message = 2;
  repeated StackTraceElementWrapper stack_trace = 3;
  optional ExceptionWrapper cause = 4;
}

message StackTraceElementWrapper {
    optional string class_name = 1;
    optional string file_name = 2;
    optional int32 line_number = 3;
    optional string method_name = 4;
    optional bool is_native_method = 5;
}

message ParsingError{
  optional int32 start_column = 2;
  optional int32 start_row = 3;
  optional int32 end_column = 4;
  optional int32 end_row = 5;
}

message RecordBatchDef {
  optional int32 record_count = 1;
  repeated SerializedField field = 2;
  optional bool carries_two_byte_selection_vector = 3;
  // The value is set when result set is disabled and its value corresponds to number
  // of rows affected by query (see JDBC java.sql.ResultSet#getUpdateCount())
  optional int32 affected_rows_count = 4;
}

message NamePart{

  enum Type{
    NAME = 0;
    ARRAY = 1;
  }

  optional Type type = 1;
  optional string name = 2;
  optional NamePart child = 3;
}

message SerializedField {
  optional common.MajorType major_type = 1; // the type associated with this field.
  optional NamePart name_part = 2;
  repeated SerializedField child = 3; // only in the cases of type == MAP or REPEAT_MAP or REPEATED_LIST

  optional int32 value_count = 4;
  optional int32 var_byte_length = 5;
  optional int32 buffer_length = 7;
}

message NodeStatus {
	optional int32 node_id = 1;
	optional int64 memory_footprint = 2;
}

/*
 * Used by the server to report informations about the query state to the client
 */
message QueryResult {
	enum QueryState {
	  STARTING = 0; // query has been scheduled for execution. This is post-enqueued.
	  RUNNING = 1;
	  COMPLETED = 2; // query has completed successfully
	  CANCELED = 3; // query has been cancelled, and all cleanup is complete
	  FAILED = 4;
	  CANCELLATION_REQUESTED = 5; // cancellation has been requested, and is being processed
	  ENQUEUED = 6; // query has been enqueued. this is pre-starting.
	  PREPARING = 7; // query is at preparation stage, foreman is initializing
	  PLANNING = 8; // query is at planning stage (includes logical or / and physical planning)
	}

	optional QueryState query_state = 1;
	optional QueryId query_id = 2;
	repeated DrillPBError error = 3;
}

/*
 * Used by the server when sending query result data batches to the client
 */
message QueryData {
  optional QueryId query_id = 1;
  optional int32 row_count = 2;
  optional RecordBatchDef def = 3;
  optional int32 affected_rows_count = 4;
}

message QueryInfo {
  optional string query = 1;
  optional int64 start = 2;
  optional QueryResult.QueryState state = 3;
  optional string user = 4 [default = "-"];
  optional DrillbitEndpoint foreman = 5;
  optional string options_json = 6;
  optional double total_cost = 7;
  optional string queue_name = 8 [default = "-"];
}

message QueryProfile {
  optional QueryId id = 1;
  optional QueryType type = 2;
  optional int64 start = 3;
  optional int64 end = 4;
  optional string query = 5;
  optional string plan = 6;
  optional DrillbitEndpoint foreman = 7;
  optional QueryResult.QueryState state = 8;
  optional int32 total_fragments = 9;
  optional int32 finished_fragments = 10;
  repeated MajorFragmentProfile fragment_profile = 11;
  optional string user = 12 [default = "-"];
  optional string error = 13;
  optional string verboseError = 14;
  optional string error_id = 15;
  optional string error_node = 16;
  optional string options_json = 17;
  optional int64 planEnd = 18;
  optional int64 queueWaitEnd = 19;
  optional double total_cost = 20;
  optional string queue_name = 21 [default = "-"];
  optional string queryId = 22;
}

message MajorFragmentProfile {
  optional int32 major_fragment_id = 1;
  repeated MinorFragmentProfile minor_fragment_profile = 2;
}

message MinorFragmentProfile {
  optional FragmentState state = 1;
  optional DrillPBError error = 2;
  optional int32 minor_fragment_id = 3;
  repeated OperatorProfile operator_profile = 4;
  optional int64 start_time = 5;
  optional int64 end_time = 6;
  optional int64 memory_used = 7;
  optional int64 max_memory_used = 8;
  optional DrillbitEndpoint endpoint = 9;
  optional int64 last_update = 10;
  optional int64 last_progress = 11;
}

message OperatorProfile {
  repeated StreamProfile input_profile = 1;
  optional int32 operator_id = 3;
  optional int32 operator_type = 4;
  optional int64 setup_nanos = 5;
  optional int64 process_nanos = 6;
  optional int64 peak_local_memory_allocated = 7;
  repeated MetricValue metric = 8;
  optional int64 wait_nanos = 9;
}

message StreamProfile {
  optional int64 records = 1;
  optional int64 batches = 2;
  optional int64 schemas = 3;
}

message MetricValue {
  optional int32 metric_id = 1;
  optional int64 long_value = 2;
  optional double double_value = 3;
}

enum FragmentState {
  SENDING = 0;
  AWAITING_ALLOCATION = 1;
  RUNNING = 2;
  FINISHED = 3;
  CANCELLED = 4;
  FAILED = 5;
  CANCELLATION_REQUESTED = 6;
}

enum CoreOperatorType {
  SINGLE_SENDER = 0;
  BROADCAST_SENDER = 1;
  FILTER = 2;
  HASH_AGGREGATE = 3;
  HASH_JOIN = 4;
  MERGE_JOIN = 5;
  HASH_PARTITION_SENDER = 6;
  LIMIT = 7;
  MERGING_RECEIVER = 8;
  ORDERED_PARTITION_SENDER = 9;
  PROJECT = 10;
  UNORDERED_RECEIVER = 11;
  RANGE_PARTITION_SENDER = 12;
  SCREEN = 13;
  SELECTION_VECTOR_REMOVER = 14;
  STREAMING_AGGREGATE = 15;
  TOP_N_SORT = 16;
  EXTERNAL_SORT = 17;
  TRACE = 18;
  UNION = 19;
  OLD_SORT = 20;
  PARQUET_ROW_GROUP_SCAN = 21;
  HIVE_SUB_SCAN = 22;
  SYSTEM_TABLE_SCAN = 23;
  MOCK_SUB_SCAN = 24;
  PARQUET_WRITER = 25;
  DIRECT_SUB_SCAN = 26;
  TEXT_WRITER = 27;
  TEXT_SUB_SCAN = 28;
  JSON_SUB_SCAN = 29;
  INFO_SCHEMA_SUB_SCAN = 30;
  COMPLEX_TO_JSON = 31;
  PRODUCER_CONSUMER = 32;
  HBASE_SUB_SCAN = 33;
  WINDOW = 34;
  NESTED_LOOP_JOIN = 35;
  AVRO_SUB_SCAN = 36;
  PCAP_SUB_SCAN = 37;
  KAFKA_SUB_SCAN = 38;
  KUDU_SUB_SCAN = 39;
  FLATTEN = 40;
  LATERAL_JOIN = 41;
  UNNEST = 42;
  HIVE_DRILL_NATIVE_PARQUET_ROW_GROUP_SCAN = 43;
  JDBC_SCAN = 44;
  REGEX_SUB_SCAN = 45;
  MAPRDB_SUB_SCAN = 46;
  MONGO_SUB_SCAN = 47;
  KUDU_WRITER = 48;
  OPEN_TSDB_SUB_SCAN = 49;
  JSON_WRITER = 50;
  HTPPD_LOG_SUB_SCAN = 51;
  IMAGE_SUB_SCAN = 52;
  SEQUENCE_SUB_SCAN = 53;
  PARTITION_LIMIT = 54;
  PCAPNG_SUB_SCAN = 55;
  RUNTIME_FILTER = 56;
  ROWKEY_JOIN = 57;
  SYSLOG_SUB_SCAN = 58;
  STATISTICS_AGGREGATE = 59;
  UNPIVOT_MAPS = 60;
  STATISTICS_MERGE = 61;
}

/* Registry that contains list of jars, each jar contains its name and list of function signatures.
Structure example:
REGISTRY    -> Jar1.jar   -> upper(VARCHAR-REQUIRED)
                          -> upper(VARCHAR-OPTIONAL)

            -> Jar2.jar   -> lower(VARCHAR-REQUIRED)
                          -> lower(VARCHAR-OPTIONAL)
*/
message Registry {
  repeated Jar jar = 1;
}

/* Jar contains jar name and list of function signatures.
 Function signature is concatenation of function name and its input parameters. */
message Jar {
  optional string name = 1;
  repeated string function_signature = 2;
}

enum SaslStatus {
  SASL_UNKNOWN = 0;
  SASL_START = 1;
  SASL_IN_PROGRESS = 2;
  SASL_SUCCESS = 3;
  SASL_FAILED = 4;
}

message SaslMessage {
  optional string mechanism = 1;
  optional bytes data = 2;
  optional SaslStatus status = 3;
}