forked from heavyai/heavydb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
mapd.thrift
440 lines (385 loc) · 12.8 KB
/
mapd.thrift
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
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
namespace java com.mapd.thrift.server
include "completion_hints.thrift"
enum TDatumType {
SMALLINT,
INT,
BIGINT,
FLOAT,
DECIMAL,
DOUBLE,
STR,
TIME,
TIMESTAMP,
DATE,
BOOL,
INTERVAL_DAY_TIME,
INTERVAL_YEAR_MONTH
}
enum TEncodingType {
NONE,
FIXED,
RL,
DIFF,
DICT,
SPARSE
}
enum TExecuteMode {
HYBRID,
GPU,
CPU
}
enum TDeviceType {
CPU,
GPU
}
enum TTableType {
DELIMITED,
POLYGON
}
/* union */ struct TDatumVal {
1: i64 int_val,
2: double real_val,
3: string str_val,
4: list<TDatum> arr_val
}
struct TDatum {
1: TDatumVal val,
2: bool is_null
}
struct TStringValue {
1: string str_val
2: bool is_null
}
struct TTypeInfo {
1: TDatumType type,
4: TEncodingType encoding,
2: bool nullable,
3: bool is_array,
5: i32 precision,
6: i32 scale,
7: i32 comp_param
}
struct TColumnType {
1: string col_name,
2: TTypeInfo col_type,
3: bool is_reserved_keyword,
4: string src_name,
5: bool is_system
}
struct TRow {
1: list<TDatum> cols
}
/* union */ struct TColumnData {
1: list<i64> int_col,
2: list<double> real_col,
3: list<string> str_col,
4: list<TColumn> arr_col
}
struct TColumn {
1: TColumnData data,
2: list<bool> nulls
}
struct TStringRow {
1: list<TStringValue> cols
}
typedef list<TColumnType> TRowDescriptor
typedef map<string, TColumnType> TTableDescriptor
typedef string TSessionId
typedef i64 TQueryId
enum TMergeType {
UNION,
REDUCE
}
struct TStepResult {
1: string serialized_rows
2: bool execution_finished
3: TMergeType merge_type
4: bool sharded
5: TRowDescriptor row_desc
6: i32 node_id
}
struct TRowSet {
1: TRowDescriptor row_desc
2: list<TRow> rows
3: list<TColumn> columns
4: bool is_columnar
}
struct TQueryResult {
1: TRowSet row_set
2: i64 execution_time_ms
3: i64 total_time_ms
4: string nonce
}
struct TDataFrame {
1: binary sm_handle
2: i64 sm_size
3: binary df_handle
4: i64 df_size
}
struct TDBInfo {
1: string db_name
2: string db_owner
}
exception TMapDException {
1: string error_msg
}
struct TRenderProperty {
1: TDatumType property_type
2: TDatumVal property_value
}
struct TCopyParams {
1: string delimiter
2: string null_str
3: bool has_header
4: bool quoted
5: string quote
6: string escape
7: string line_delim
8: string array_delim
9: string array_begin
10: string array_end
11: i32 threads
12: TTableType table_type=TTableType.DELIMITED
}
struct TDetectResult {
1: TRowSet row_set
2: TCopyParams copy_params
}
struct TImportStatus {
1: i64 elapsed
2: i64 rows_completed
3: i64 rows_estimated
4: i64 rows_rejected
}
struct TFrontendView {
1: string view_name
2: string view_state
3: string image_hash
4: string update_time
5: string view_metadata
}
struct TServerStatus {
1: bool read_only
2: string version
3: bool rendering_enabled
4: i64 start_time
5: string edition
6: string host_name
}
typedef map<string, TRenderProperty> TRenderPropertyMap
typedef map<string, TRenderPropertyMap> TColumnRenderMap
struct TPixel {
1: i64 x
2: i64 y
}
struct TPixelTableRowResult {
1: TPixel pixel
2: string vega_table_name
3: i64 table_id
4: i64 row_id
5: TRowSet row_set
6: string nonce
}
struct TRenderResult {
1: binary image
2: string nonce
3: i64 execution_time_ms
4: i64 render_time_ms
5: i64 total_time_ms
}
struct TGpuSpecification {
1: i32 num_sm
2: i64 clock_frequency_kHz
3: i64 memory
4: i16 compute_capability_major
5: i16 compute_capability_minor
}
struct THardwareInfo {
1: i16 num_gpu_hw
2: i16 num_cpu_hw
3: i16 num_gpu_allocated
4: i16 start_gpu
5: string host_name
6: list<TGpuSpecification> gpu_info
}
struct TClusterHardwareInfo {
1: list<THardwareInfo> hardware_info
}
struct TMemoryData {
1: i64 slab
2: i32 start_page
3: i64 num_pages
4: i32 touch
5: list<i64> chunk_key
6: i32 buffer_epoch
7: bool is_free
}
struct TNodeMemoryInfo {
1: string host_name
2: i64 page_size
3: i64 max_num_pages
4: i64 num_pages_allocated
5: bool is_allocation_capped
6: list<TMemoryData> node_memory_data
}
struct TTableDetails {
1: TRowDescriptor row_desc
2: i64 fragment_size
3: i64 page_size
4: i64 max_rows
5: string view_sql
6: i64 shard_count
7: string key_metainfo
8: bool is_temporary
}
enum TExpressionRangeType {
INVALID,
INTEGER,
FLOAT,
DOUBLE
}
struct TColumnRange {
1: TExpressionRangeType type
2: i32 col_id
3: i32 table_id
4: bool has_nulls
5: i64 int_min
6: i64 int_max
7: i64 bucket
8: double fp_min
9: double fp_max
}
struct TDictionaryGeneration {
1: i32 dict_id
2: i64 entry_count
}
struct TTableGeneration {
1: i32 table_id
2: i64 tuple_count
3: i64 start_rowid
}
struct TPendingQuery {
1: TQueryId id
2: list<TColumnRange> column_ranges
3: list<TDictionaryGeneration> dictionary_generations
4: list<TTableGeneration> table_generations
}
struct TVarLen {
1: binary payload
2: bool is_null
}
union TDataBlockPtr {
1: binary fixed_len_data
2: list<TVarLen> var_len_data
}
struct TInsertData {
1: i32 db_id
2: i32 table_id
3: list<i32> column_ids
4: list<TDataBlockPtr> data
5: i64 num_rows
}
struct TRawRenderPassDataResult {
1: i32 num_channels
2: binary pixels
3: binary row_ids_A
4: binary row_ids_B
5: binary table_ids
6: binary accum_data
}
typedef map<i32, TRawRenderPassDataResult> TRenderPassMap
struct TRawPixelDataResult {
1: i32 width
2: i32 height
3: TRenderPassMap render_pass_map
8: i64 execution_time_ms
9: i64 render_time_ms
10: i64 total_time_ms
}
struct TAccessPrivileges {
1: bool select_;
2: bool insert_;
3: bool create_;
4: bool truncate_;
}
enum TDBObjectType {
AbstractDBObjectType = 0,
DatabaseDBObjectType,
TableDBObjectType,
ColumnDBObjectType,
DashboardDBObjectType
}
struct TDBObject {
1: string objectName
2: TDBObjectType objectType
3: list<bool> privs
}
service MapD {
# connection, admin
TSessionId connect(1: string user, 2: string passwd, 3: string dbname) throws (1: TMapDException e)
void disconnect(1: TSessionId session) throws (1: TMapDException e)
TServerStatus get_server_status(1: TSessionId session) throws (1: TMapDException e)
list<TServerStatus> get_status(1: TSessionId session) throws (1: TMapDException e)
TClusterHardwareInfo get_hardware_info(1: TSessionId session) throws (1: TMapDException e)
list<string> get_tables(1: TSessionId session) throws (1: TMapDException e)
TTableDetails get_table_details(1: TSessionId session, 2: string table_name) throws (1: TMapDException e)
TTableDetails get_internal_table_details(1: TSessionId session, 2: string table_name) throws (1: TMapDException e)
list<string> get_users(1: TSessionId session) throws (1: TMapDException e)
list<TDBInfo> get_databases(1: TSessionId session) throws (1: TMapDException e)
string get_version() throws (1: TMapDException e)
void start_heap_profile(1: TSessionId session) throws (1: TMapDException e)
void stop_heap_profile(1: TSessionId session) throws (1: TMapDException e)
string get_heap_profile(1: TSessionId session) throws (1: TMapDException e)
list<TNodeMemoryInfo> get_memory(1: TSessionId session, 2: string memory_level) throws (1: TMapDException e)
void clear_cpu_memory(1: TSessionId session) throws (1: TMapDException e)
void clear_gpu_memory(1: TSessionId session) throws (1: TMapDException e)
void set_table_epoch (1: TSessionId session 2: i32 db_id 3: i32 table_id 4: i32 new_epoch) throws (1: TMapDException e)
i32 get_table_epoch (1: TSessionId session 2: i32 db_id 3: i32 table_id);
# query, render
TQueryResult sql_execute(1: TSessionId session, 2: string query 3: bool column_format, 4: string nonce, 5: i32 first_n = -1, 6: i32 at_most_n = -1) throws (1: TMapDException e)
TDataFrame sql_execute_df(1: TSessionId session, 2: string query 3: TDeviceType device_type 4: i32 device_id = 0 5: i32 first_n = -1) throws (1: TMapDException e)
TDataFrame sql_execute_gdf(1: TSessionId session, 2: string query 3: i32 device_id = 0, 4: i32 first_n = -1) throws (1: TMapDException e)
void deallocate_df(1: TSessionId session, 2: TDataFrame df, 3: TDeviceType device_type, 4: i32 device_id = 0) throws (1: TMapDException e)
void interrupt(1: TSessionId session) throws (1: TMapDException e)
TTableDescriptor sql_validate(1: TSessionId session, 2: string query) throws (1: TMapDException e)
list<completion_hints.TCompletionHint> get_completion_hints(1: TSessionId session, 2:string sql, 3:i32 cursor) throws (1: TMapDException e)
void set_execution_mode(1: TSessionId session, 2: TExecuteMode mode) throws (1: TMapDException e)
TRenderResult render_vega(1: TSessionId session, 2: i64 widget_id, 3: string vega_json, 4: i32 compression_level, 5: string nonce) throws (1: TMapDException e)
TPixelTableRowResult get_result_row_for_pixel(1: TSessionId session, 2: i64 widget_id, 3: TPixel pixel, 4: map<string, list<string>> table_col_names, 5: bool column_format, 6: i32 pixelRadius, 7: string nonce) throws (1: TMapDException e)
# Immerse
TFrontendView get_frontend_view(1: TSessionId session, 2: string view_name) throws (1: TMapDException e)
list<TFrontendView> get_frontend_views(1: TSessionId session) throws (1: TMapDException e)
void create_frontend_view(1: TSessionId session, 2: string view_name, 3: string view_state, 4: string image_hash, 5: string view_metadata) throws (1: TMapDException e)
void delete_frontend_view(1: TSessionId session, 2: string view_name) throws (1: TMapDException e)
TFrontendView get_link_view(1: TSessionId session, 2: string link) throws (1: TMapDException e)
string create_link(1: TSessionId session, 2: string view_state, 3: string view_metadata) throws (1: TMapDException e)
# import
void load_table_binary(1: TSessionId session, 2: string table_name, 3: list<TRow> rows) throws (1: TMapDException e)
void load_table_binary_columnar(1: TSessionId session, 2: string table_name, 3: list<TColumn> cols) throws (1: TMapDException e)
void load_table_binary_arrow(1: TSessionId session, 2: string table_name, 3: binary arrow_stream) throws (1: TMapDException e)
void load_table(1: TSessionId session, 2: string table_name, 3: list<TStringRow> rows) throws (1: TMapDException e)
TDetectResult detect_column_types(1: TSessionId session, 2: string file_name, 3: TCopyParams copy_params) throws (1: TMapDException e)
void create_table(1: TSessionId session, 2: string table_name, 3: TRowDescriptor row_desc, 4: TTableType table_type=TTableType.DELIMITED) throws (1: TMapDException e)
void import_table(1: TSessionId session, 2: string table_name, 3: string file_name, 4: TCopyParams copy_params) throws (1: TMapDException e)
void import_geo_table(1: TSessionId session, 2: string table_name, 3: string file_name, 4: TCopyParams copy_params, 5: TRowDescriptor row_desc) throws (1: TMapDException e)
TImportStatus import_table_status(1: TSessionId session, 2: string import_id) throws (1: TMapDException e)
# distributed
TPendingQuery start_query(1: TSessionId session, 2: string query_ra, 3: bool just_explain) throws (1: TMapDException e)
TStepResult execute_first_step(1: TPendingQuery pending_query) throws (1: TMapDException e)
void broadcast_serialized_rows(1: string serialized_rows, 2: TRowDescriptor row_desc, 3: TQueryId query_id) throws (1: TMapDException e)
TRawPixelDataResult render_vega_raw_pixels(1: TSessionId session, 2: i64 widget_id, 3: i16 node_idx 4: string vega_json 5: string nonce) throws (1: TMapDException e)
void insert_data(1: TSessionId session, 2: TInsertData insert_data) throws (1: TMapDException e)
void checkpoint(1: TSessionId session, 2: i32 db_id, 3: i32 table_id) throws (1: TMapDException e)
# deprecated
TTableDescriptor get_table_descriptor(1: TSessionId session, 2: string table_name) throws (1: TMapDException e)
TRowDescriptor get_row_descriptor(1: TSessionId session, 2: string table_name) throws (1: TMapDException e)
# object privileges
list<string> get_role(1: TSessionId session 2: string roleName 3: bool userPrivateRole) throws (1: TMapDException e)
list<string> get_all_roles(1: TSessionId session 2: bool userPrivateRole) throws (1: TMapDException e)
list<TAccessPrivileges> get_db_object_privileges_for_role(1: TSessionId session 2: string roleName 3: i16 objectType 4: string objectName) throws (1: TMapDException e)
list<TDBObject> get_db_objects_for_role(1: TSessionId session 2: string roleName) throws (1: TMapDException e)
list<TDBObject> get_db_object_privs(1: TSessionId session 2: string objectName) throws (1: TMapDException e)
list<string> get_all_roles_for_user(1: TSessionId session 2: string userName) throws (1: TMapDException e)
list<TAccessPrivileges> get_db_object_privileges_for_user(1: TSessionId session 2: string userName 3: i16 objectType 4: string objectName) throws (1: TMapDException e)
list<TDBObject> get_db_objects_for_user(1: TSessionId session 2: string userName) throws (1: TMapDException e)
}