-
Notifications
You must be signed in to change notification settings - Fork 1
/
hive.thrift
1271 lines (1050 loc) · 33.2 KB
/
hive.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
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Coding Conventions for this file:
//
// Structs/Enums/Unions
// * Struct, Enum, and Union names begin with a "T",
// and use a capital letter for each new word, with no underscores.
// * All fields should be declared as either optional or required.
//
// Functions
// * Function names start with a capital letter and have a capital letter for
// each new word, with no underscores.
// * Each function should take exactly one parameter, named TFunctionNameReq,
// and should return either void or TFunctionNameResp. This convention allows
// incremental updates.
//
// Services
// * Service names begin with the letter "T", use a capital letter for each
// new word (with no underscores), and end with the word "Service".
namespace java org.apache.hive.service.rpc.thrift
namespace cpp apache.hive.service.rpc.thrift
namespace go thriftlib
// List of protocol versions. A new token should be
// added to the end of this list every time a change is made.
enum TProtocolVersion {
HIVE_CLI_SERVICE_PROTOCOL_V1,
// V2 adds support for asynchronous execution
HIVE_CLI_SERVICE_PROTOCOL_V2
// V3 add varchar type, primitive type qualifiers
HIVE_CLI_SERVICE_PROTOCOL_V3
// V4 add decimal precision/scale, char type
HIVE_CLI_SERVICE_PROTOCOL_V4
// V5 adds error details when GetOperationStatus returns in error state
HIVE_CLI_SERVICE_PROTOCOL_V5
// V6 uses binary type for binary payload (was string) and uses columnar result set
HIVE_CLI_SERVICE_PROTOCOL_V6
// V7 adds support for delegation token based connection
HIVE_CLI_SERVICE_PROTOCOL_V7
// V8 adds support for interval types
HIVE_CLI_SERVICE_PROTOCOL_V8
// V9 adds support for serializing ResultSets in SerDe
HIVE_CLI_SERVICE_PROTOCOL_V9
// V10 adds support for in place updates via GetOperationStatus
HIVE_CLI_SERVICE_PROTOCOL_V10
}
enum TTypeId {
BOOLEAN_TYPE,
TINYINT_TYPE,
SMALLINT_TYPE,
INT_TYPE,
BIGINT_TYPE,
FLOAT_TYPE,
DOUBLE_TYPE,
STRING_TYPE,
TIMESTAMP_TYPE,
BINARY_TYPE,
ARRAY_TYPE,
MAP_TYPE,
STRUCT_TYPE,
UNION_TYPE,
USER_DEFINED_TYPE,
DECIMAL_TYPE,
NULL_TYPE,
DATE_TYPE,
VARCHAR_TYPE,
CHAR_TYPE,
INTERVAL_YEAR_MONTH_TYPE,
INTERVAL_DAY_TIME_TYPE
}
const set<TTypeId> PRIMITIVE_TYPES = [
TTypeId.BOOLEAN_TYPE,
TTypeId.TINYINT_TYPE,
TTypeId.SMALLINT_TYPE,
TTypeId.INT_TYPE,
TTypeId.BIGINT_TYPE,
TTypeId.FLOAT_TYPE,
TTypeId.DOUBLE_TYPE,
TTypeId.STRING_TYPE,
TTypeId.TIMESTAMP_TYPE,
TTypeId.BINARY_TYPE,
TTypeId.DECIMAL_TYPE,
TTypeId.NULL_TYPE,
TTypeId.DATE_TYPE,
TTypeId.VARCHAR_TYPE,
TTypeId.CHAR_TYPE,
TTypeId.INTERVAL_YEAR_MONTH_TYPE,
TTypeId.INTERVAL_DAY_TIME_TYPE
]
const set<TTypeId> COMPLEX_TYPES = [
TTypeId.ARRAY_TYPE
TTypeId.MAP_TYPE
TTypeId.STRUCT_TYPE
TTypeId.UNION_TYPE
TTypeId.USER_DEFINED_TYPE
]
const set<TTypeId> COLLECTION_TYPES = [
TTypeId.ARRAY_TYPE
TTypeId.MAP_TYPE
]
const map<TTypeId,string> TYPE_NAMES = {
TTypeId.BOOLEAN_TYPE: "BOOLEAN",
TTypeId.TINYINT_TYPE: "TINYINT",
TTypeId.SMALLINT_TYPE: "SMALLINT",
TTypeId.INT_TYPE: "INT",
TTypeId.BIGINT_TYPE: "BIGINT",
TTypeId.FLOAT_TYPE: "FLOAT",
TTypeId.DOUBLE_TYPE: "DOUBLE",
TTypeId.STRING_TYPE: "STRING",
TTypeId.TIMESTAMP_TYPE: "TIMESTAMP",
TTypeId.BINARY_TYPE: "BINARY",
TTypeId.ARRAY_TYPE: "ARRAY",
TTypeId.MAP_TYPE: "MAP",
TTypeId.STRUCT_TYPE: "STRUCT",
TTypeId.UNION_TYPE: "UNIONTYPE",
TTypeId.DECIMAL_TYPE: "DECIMAL",
TTypeId.NULL_TYPE: "NULL"
TTypeId.DATE_TYPE: "DATE"
TTypeId.VARCHAR_TYPE: "VARCHAR"
TTypeId.CHAR_TYPE: "CHAR"
TTypeId.INTERVAL_YEAR_MONTH_TYPE: "INTERVAL_YEAR_MONTH"
TTypeId.INTERVAL_DAY_TIME_TYPE: "INTERVAL_DAY_TIME"
}
// Thrift does not support recursively defined types or forward declarations,
// which makes it difficult to represent Hive's nested types.
// To get around these limitations TTypeDesc employs a type list that maps
// integer "pointers" to TTypeEntry objects. The following examples show
// how different types are represented using this scheme:
//
// "INT":
// TTypeDesc {
// types = [
// TTypeEntry.primitive_entry {
// type = INT_TYPE
// }
// ]
// }
//
// "ARRAY<INT>":
// TTypeDesc {
// types = [
// TTypeEntry.array_entry {
// object_type_ptr = 1
// },
// TTypeEntry.primitive_entry {
// type = INT_TYPE
// }
// ]
// }
//
// "MAP<INT,STRING>":
// TTypeDesc {
// types = [
// TTypeEntry.map_entry {
// key_type_ptr = 1
// value_type_ptr = 2
// },
// TTypeEntry.primitive_entry {
// type = INT_TYPE
// },
// TTypeEntry.primitive_entry {
// type = STRING_TYPE
// }
// ]
// }
typedef i32 TTypeEntryPtr
// Valid TTypeQualifiers key names
const string CHARACTER_MAXIMUM_LENGTH = "characterMaximumLength"
// Type qualifier key name for decimal
const string PRECISION = "precision"
const string SCALE = "scale"
union TTypeQualifierValue {
1: optional i32 i32Value
2: optional string stringValue
}
// Type qualifiers for primitive type.
struct TTypeQualifiers {
1: required map <string, TTypeQualifierValue> qualifiers
}
// Type entry for a primitive type.
struct TPrimitiveTypeEntry {
// The primitive type token. This must satisfy the condition
// that type is in the PRIMITIVE_TYPES set.
1: required TTypeId type
2: optional TTypeQualifiers typeQualifiers
}
// Type entry for an ARRAY type.
struct TArrayTypeEntry {
1: required TTypeEntryPtr objectTypePtr
}
// Type entry for a MAP type.
struct TMapTypeEntry {
1: required TTypeEntryPtr keyTypePtr
2: required TTypeEntryPtr valueTypePtr
}
// Type entry for a STRUCT type.
struct TStructTypeEntry {
1: required map<string, TTypeEntryPtr> nameToTypePtr
}
// Type entry for a UNIONTYPE type.
struct TUnionTypeEntry {
1: required map<string, TTypeEntryPtr> nameToTypePtr
}
struct TUserDefinedTypeEntry {
// The fully qualified name of the class implementing this type.
1: required string typeClassName
}
// We use a union here since Thrift does not support inheritance.
union TTypeEntry {
1: TPrimitiveTypeEntry primitiveEntry
2: TArrayTypeEntry arrayEntry
3: TMapTypeEntry mapEntry
4: TStructTypeEntry structEntry
5: TUnionTypeEntry unionEntry
6: TUserDefinedTypeEntry userDefinedTypeEntry
}
// Type descriptor for columns.
struct TTypeDesc {
// The "top" type is always the first element of the list.
// If the top type is an ARRAY, MAP, STRUCT, or UNIONTYPE
// type, then subsequent elements represent nested types.
1: required list<TTypeEntry> types
}
// A result set column descriptor.
struct TColumnDesc {
// The name of the column
1: required string columnName
// The type descriptor for this column
2: required TTypeDesc typeDesc
// The ordinal position of this column in the schema
3: required i32 position
4: optional string comment
}
// Metadata used to describe the schema (column names, types, comments)
// of result sets.
struct TTableSchema {
1: required list<TColumnDesc> columns
}
// A Boolean column value.
struct TBoolValue {
// NULL if value is unset.
1: optional bool value
}
// A Byte column value.
struct TByteValue {
// NULL if value is unset.
1: optional byte value
}
// A signed, 16 bit column value.
struct TI16Value {
// NULL if value is unset
1: optional i16 value
}
// A signed, 32 bit column value
struct TI32Value {
// NULL if value is unset
1: optional i32 value
}
// A signed 64 bit column value
struct TI64Value {
// NULL if value is unset
1: optional i64 value
}
// A floating point 64 bit column value
struct TDoubleValue {
// NULL if value is unset
1: optional double value
}
struct TStringValue {
// NULL if value is unset
1: optional string value
}
// A single column value in a result set.
// Note that Hive's type system is richer than Thrift's,
// so in some cases we have to map multiple Hive types
// to the same Thrift type. On the client-side this is
// disambiguated by looking at the Schema of the
// result set.
union TColumnValue {
1: TBoolValue boolVal // BOOLEAN
2: TByteValue byteVal // TINYINT
3: TI16Value i16Val // SMALLINT
4: TI32Value i32Val // INT
5: TI64Value i64Val // BIGINT, TIMESTAMP
6: TDoubleValue doubleVal // FLOAT, DOUBLE
7: TStringValue stringVal // STRING, LIST, MAP, STRUCT, UNIONTYPE, BINARY, DECIMAL, NULL, INTERVAL_YEAR_MONTH, INTERVAL_DAY_TIME
}
// Represents a row in a rowset.
struct TRow {
1: required list<TColumnValue> colVals
}
struct TBoolColumn {
1: required list<bool> values
2: required binary nulls
}
struct TByteColumn {
1: required list<byte> values
2: required binary nulls
}
struct TI16Column {
1: required list<i16> values
2: required binary nulls
}
struct TI32Column {
1: required list<i32> values
2: required binary nulls
}
struct TI64Column {
1: required list<i64> values
2: required binary nulls
}
struct TDoubleColumn {
1: required list<double> values
2: required binary nulls
}
struct TStringColumn {
1: required list<string> values
2: required binary nulls
}
struct TBinaryColumn {
1: required list<binary> values
2: required binary nulls
}
// Note that Hive's type system is richer than Thrift's,
// so in some cases we have to map multiple Hive types
// to the same Thrift type. On the client-side this is
// disambiguated by looking at the Schema of the
// result set.
union TColumn {
1: TBoolColumn boolVal // BOOLEAN
2: TByteColumn byteVal // TINYINT
3: TI16Column i16Val // SMALLINT
4: TI32Column i32Val // INT
5: TI64Column i64Val // BIGINT, TIMESTAMP
6: TDoubleColumn doubleVal // FLOAT, DOUBLE
7: TStringColumn stringVal // STRING, LIST, MAP, STRUCT, UNIONTYPE, DECIMAL, NULL
8: TBinaryColumn binaryVal // BINARY
}
// Represents a rowset
struct TRowSet {
// The starting row offset of this rowset.
1: required i64 startRowOffset
2: required list<TRow> rows
3: optional list<TColumn> columns
4: optional binary binaryColumns
5: optional i32 columnCount
}
// The return status code contained in each response.
enum TStatusCode {
SUCCESS_STATUS,
SUCCESS_WITH_INFO_STATUS,
STILL_EXECUTING_STATUS,
ERROR_STATUS,
INVALID_HANDLE_STATUS
}
// The return status of a remote request
struct TStatus {
1: required TStatusCode statusCode
// If status is SUCCESS_WITH_INFO, info_msgs may be populated with
// additional diagnostic information.
2: optional list<string> infoMessages
// If status is ERROR, then the following fields may be set
3: optional string sqlState // as defined in the ISO/IEF CLI specification
4: optional i32 errorCode // internal error code
5: optional string errorMessage
}
// The state of an operation (i.e. a query or other
// asynchronous operation that generates a result set)
// on the server.
enum TOperationState {
// The operation has been initialized
INITIALIZED_STATE,
// The operation is running. In this state the result
// set is not available.
RUNNING_STATE,
// The operation has completed. When an operation is in
// this state its result set may be fetched.
FINISHED_STATE,
// The operation was canceled by a client
CANCELED_STATE,
// The operation was closed by a client
CLOSED_STATE,
// The operation failed due to an error
ERROR_STATE,
// The operation is in an unrecognized state
UKNOWN_STATE,
// The operation is in an pending state
PENDING_STATE,
// The operation is in an timedout state
TIMEDOUT_STATE,
}
// A string identifier. This is interpreted literally.
typedef string TIdentifier
// A search pattern.
//
// Valid search pattern characters:
// '_': Any single character.
// '%': Any sequence of zero or more characters.
// '\': Escape character used to include special characters,
// e.g. '_', '%', '\'. If a '\' precedes a non-special
// character it has no special meaning and is interpreted
// literally.
typedef string TPattern
// A search pattern or identifier. Used as input
// parameter for many of the catalog functions.
typedef string TPatternOrIdentifier
struct THandleIdentifier {
// 16 byte globally unique identifier
// This is the public ID of the handle and
// can be used for reporting.
1: required binary guid,
// 16 byte secret generated by the server
// and used to verify that the handle is not
// being hijacked by another user.
2: required binary secret,
}
// Client-side handle to persistent
// session information on the server-side.
struct TSessionHandle {
1: required THandleIdentifier sessionId
}
// The subtype of an OperationHandle.
enum TOperationType {
EXECUTE_STATEMENT,
GET_TYPE_INFO,
GET_CATALOGS,
GET_SCHEMAS,
GET_TABLES,
GET_TABLE_TYPES,
GET_COLUMNS,
GET_FUNCTIONS,
UNKNOWN,
}
// Client-side reference to a task running
// asynchronously on the server.
struct TOperationHandle {
1: required THandleIdentifier operationId
2: required TOperationType operationType
// If hasResultSet = TRUE, then this operation
// generates a result set that can be fetched.
// Note that the result set may be empty.
//
// If hasResultSet = FALSE, then this operation
// does not generate a result set, and calling
// GetResultSetMetadata or FetchResults against
// this OperationHandle will generate an error.
3: required bool hasResultSet
// For operations that don't generate result sets,
// modifiedRowCount is either:
//
// 1) The number of rows that were modified by
// the DML operation (e.g. number of rows inserted,
// number of rows deleted, etc).
//
// 2) 0 for operations that don't modify or add rows.
//
// 3) < 0 if the operation is capable of modifiying rows,
// but Hive is unable to determine how many rows were
// modified. For example, Hive's LOAD DATA command
// doesn't generate row count information because
// Hive doesn't inspect the data as it is loaded.
//
// modifiedRowCount is unset if the operation generates
// a result set.
4: optional double modifiedRowCount
}
// OpenSession()
//
// Open a session (connection) on the server against
// which operations may be executed.
struct TOpenSessionReq {
// The version of the HiveServer2 protocol that the client is using.
1: required TProtocolVersion client_protocol = TProtocolVersion.HIVE_CLI_SERVICE_PROTOCOL_V10
// Username and password for authentication.
// Depending on the authentication scheme being used,
// this information may instead be provided by a lower
// protocol layer, in which case these fields may be
// left unset.
2: optional string username
3: optional string password
// Configuration overlay which is applied when the session is
// first created.
4: optional map<string, string> configuration
}
struct TOpenSessionResp {
1: required TStatus status
// The protocol version that the server is using.
2: required TProtocolVersion serverProtocolVersion = TProtocolVersion.HIVE_CLI_SERVICE_PROTOCOL_V10
// Session Handle
3: optional TSessionHandle sessionHandle
// The configuration settings for this session.
4: optional map<string, string> configuration
}
// CloseSession()
//
// Closes the specified session and frees any resources
// currently allocated to that session. Any open
// operations in that session will be canceled.
struct TCloseSessionReq {
1: required TSessionHandle sessionHandle
}
struct TCloseSessionResp {
1: required TStatus status
}
enum TGetInfoType {
CLI_MAX_DRIVER_CONNECTIONS = 0,
CLI_MAX_CONCURRENT_ACTIVITIES = 1,
CLI_DATA_SOURCE_NAME = 2,
CLI_FETCH_DIRECTION = 8,
CLI_SERVER_NAME = 13,
CLI_SEARCH_PATTERN_ESCAPE = 14,
CLI_DBMS_NAME = 17,
CLI_DBMS_VER = 18,
CLI_ACCESSIBLE_TABLES = 19,
CLI_ACCESSIBLE_PROCEDURES = 20,
CLI_CURSOR_COMMIT_BEHAVIOR = 23,
CLI_DATA_SOURCE_READ_ONLY = 25,
CLI_DEFAULT_TXN_ISOLATION = 26,
CLI_IDENTIFIER_CASE = 28,
CLI_IDENTIFIER_QUOTE_CHAR = 29,
CLI_MAX_COLUMN_NAME_LEN = 30,
CLI_MAX_CURSOR_NAME_LEN = 31,
CLI_MAX_SCHEMA_NAME_LEN = 32,
CLI_MAX_CATALOG_NAME_LEN = 34,
CLI_MAX_TABLE_NAME_LEN = 35,
CLI_SCROLL_CONCURRENCY = 43,
CLI_TXN_CAPABLE = 46,
CLI_USER_NAME = 47,
CLI_TXN_ISOLATION_OPTION = 72,
CLI_INTEGRITY = 73,
CLI_GETDATA_EXTENSIONS = 81,
CLI_NULL_COLLATION = 85,
CLI_ALTER_TABLE = 86,
CLI_ORDER_BY_COLUMNS_IN_SELECT = 90,
CLI_SPECIAL_CHARACTERS = 94,
CLI_MAX_COLUMNS_IN_GROUP_BY = 97,
CLI_MAX_COLUMNS_IN_INDEX = 98,
CLI_MAX_COLUMNS_IN_ORDER_BY = 99,
CLI_MAX_COLUMNS_IN_SELECT = 100,
CLI_MAX_COLUMNS_IN_TABLE = 101,
CLI_MAX_INDEX_SIZE = 102,
CLI_MAX_ROW_SIZE = 104,
CLI_MAX_STATEMENT_LEN = 105,
CLI_MAX_TABLES_IN_SELECT = 106,
CLI_MAX_USER_NAME_LEN = 107,
CLI_OJ_CAPABILITIES = 115,
CLI_XOPEN_CLI_YEAR = 10000,
CLI_CURSOR_SENSITIVITY = 10001,
CLI_DESCRIBE_PARAMETER = 10002,
CLI_CATALOG_NAME = 10003,
CLI_COLLATION_SEQ = 10004,
CLI_MAX_IDENTIFIER_LEN = 10005,
}
union TGetInfoValue {
1: string stringValue
2: i16 smallIntValue
3: i32 integerBitmask
4: i32 integerFlag
5: i32 binaryValue
6: i64 lenValue
}
// GetInfo()
//
// This function is based on ODBC's CLIGetInfo() function.
// The function returns general information about the data source
// using the same keys as ODBC.
struct TGetInfoReq {
// The sesssion to run this request against
1: required TSessionHandle sessionHandle
2: required TGetInfoType infoType
}
struct TGetInfoResp {
1: required TStatus status
2: required TGetInfoValue infoValue
}
// ExecuteStatement()
//
// Execute a statement.
// The returned OperationHandle can be used to check on the
// status of the statement, and to fetch results once the
// statement has finished executing.
struct TExecuteStatementReq {
// The session to execute the statement against
1: required TSessionHandle sessionHandle
// The statement to be executed (DML, DDL, SET, etc)
2: required string statement
// Configuration properties that are overlayed on top of the
// the existing session configuration before this statement
// is executed. These properties apply to this statement
// only and will not affect the subsequent state of the Session.
3: optional map<string, string> confOverlay
// Execute asynchronously when runAsync is true
4: optional bool runAsync = false
// The number of seconds after which the query will timeout on the server
5: optional i64 queryTimeout = 0
}
struct TExecuteStatementResp {
1: required TStatus status
2: optional TOperationHandle operationHandle
}
// GetTypeInfo()
//
// Get information about types supported by the HiveServer instance.
// The information is returned as a result set which can be fetched
// using the OperationHandle provided in the response.
//
// Refer to the documentation for ODBC's CLIGetTypeInfo function for
// the format of the result set.
struct TGetTypeInfoReq {
// The session to run this request against.
1: required TSessionHandle sessionHandle
}
struct TGetTypeInfoResp {
1: required TStatus status
2: optional TOperationHandle operationHandle
}
// GetCatalogs()
//
// Returns the list of catalogs (databases)
// Results are ordered by TABLE_CATALOG
//
// Resultset columns :
// col1
// name: TABLE_CAT
// type: STRING
// desc: Catalog name. NULL if not applicable.
//
struct TGetCatalogsReq {
// Session to run this request against
1: required TSessionHandle sessionHandle
}
struct TGetCatalogsResp {
1: required TStatus status
2: optional TOperationHandle operationHandle
}
// GetSchemas()
//
// Retrieves the schema names available in this database.
// The results are ordered by TABLE_CATALOG and TABLE_SCHEM.
// col1
// name: TABLE_SCHEM
// type: STRING
// desc: schema name
// col2
// name: TABLE_CATALOG
// type: STRING
// desc: catalog name
struct TGetSchemasReq {
// Session to run this request against
1: required TSessionHandle sessionHandle
// Name of the catalog. Must not contain a search pattern.
2: optional TIdentifier catalogName
// schema name or pattern
3: optional TPatternOrIdentifier schemaName
}
struct TGetSchemasResp {
1: required TStatus status
2: optional TOperationHandle operationHandle
}
// GetTables()
//
// Returns a list of tables with catalog, schema, and table
// type information. The information is returned as a result
// set which can be fetched using the OperationHandle
// provided in the response.
// Results are ordered by TABLE_TYPE, TABLE_CAT, TABLE_SCHEM, and TABLE_NAME
//
// Result Set Columns:
//
// col1
// name: TABLE_CAT
// type: STRING
// desc: Catalog name. NULL if not applicable.
//
// col2
// name: TABLE_SCHEM
// type: STRING
// desc: Schema name.
//
// col3
// name: TABLE_NAME
// type: STRING
// desc: Table name.
//
// col4
// name: TABLE_TYPE
// type: STRING
// desc: The table type, e.g. "TABLE", "VIEW", etc.
//
// col5
// name: REMARKS
// type: STRING
// desc: Comments about the table
//
struct TGetTablesReq {
// Session to run this request against
1: required TSessionHandle sessionHandle
// Name of the catalog or a search pattern.
2: optional TPatternOrIdentifier catalogName
// Name of the schema or a search pattern.
3: optional TPatternOrIdentifier schemaName
// Name of the table or a search pattern.
4: optional TPatternOrIdentifier tableName
// List of table types to match
// e.g. "TABLE", "VIEW", "SYSTEM TABLE", "GLOBAL TEMPORARY",
// "LOCAL TEMPORARY", "ALIAS", "SYNONYM", etc.
5: optional list<string> tableTypes
}
struct TGetTablesResp {
1: required TStatus status
2: optional TOperationHandle operationHandle
}
// GetTableTypes()
//
// Returns the table types available in this database.
// The results are ordered by table type.
//
// col1
// name: TABLE_TYPE
// type: STRING
// desc: Table type name.
struct TGetTableTypesReq {
// Session to run this request against
1: required TSessionHandle sessionHandle
}
struct TGetTableTypesResp {
1: required TStatus status
2: optional TOperationHandle operationHandle
}
// GetColumns()
//
// Returns a list of columns in the specified tables.
// The information is returned as a result set which can be fetched
// using the OperationHandle provided in the response.
// Results are ordered by TABLE_CAT, TABLE_SCHEM, TABLE_NAME,
// and ORDINAL_POSITION.
//
// Result Set Columns are the same as those for the ODBC CLIColumns
// function.
//
struct TGetColumnsReq {
// Session to run this request against
1: required TSessionHandle sessionHandle
// Name of the catalog. Must not contain a search pattern.
2: optional TIdentifier catalogName
// Schema name or search pattern
3: optional TPatternOrIdentifier schemaName
// Table name or search pattern
4: optional TPatternOrIdentifier tableName
// Column name or search pattern
5: optional TPatternOrIdentifier columnName
}
struct TGetColumnsResp {
1: required TStatus status
2: optional TOperationHandle operationHandle
}
// GetFunctions()
//
// Returns a list of functions supported by the data source. The
// behavior of this function matches
// java.sql.DatabaseMetaData.getFunctions() both in terms of
// inputs and outputs.
//
// Result Set Columns:
//
// col1
// name: FUNCTION_CAT
// type: STRING
// desc: Function catalog (may be null)
//
// col2
// name: FUNCTION_SCHEM
// type: STRING
// desc: Function schema (may be null)
//
// col3
// name: FUNCTION_NAME
// type: STRING
// desc: Function name. This is the name used to invoke the function.
//
// col4
// name: REMARKS
// type: STRING
// desc: Explanatory comment on the function.
//
// col5
// name: FUNCTION_TYPE
// type: SMALLINT
// desc: Kind of function. One of:
// * functionResultUnknown - Cannot determine if a return value or a table
// will be returned.
// * functionNoTable - Does not a return a table.
// * functionReturnsTable - Returns a table.
//
// col6
// name: SPECIFIC_NAME
// type: STRING
// desc: The name which uniquely identifies this function within its schema.
// In this case this is the fully qualified class name of the class
// that implements this function.
//
struct TGetFunctionsReq {
// Session to run this request against
1: required TSessionHandle sessionHandle
// A catalog name; must match the catalog name as it is stored in the
// database; "" retrieves those without a catalog; null means
// that the catalog name should not be used to narrow the search.
2: optional TIdentifier catalogName
// A schema name pattern; must match the schema name as it is stored
// in the database; "" retrieves those without a schema; null means
// that the schema name should not be used to narrow the search.
3: optional TPatternOrIdentifier schemaName
// A function name pattern; must match the function name as it is stored
// in the database.
4: required TPatternOrIdentifier functionName
}
struct TGetFunctionsResp {
1: required TStatus status
2: optional TOperationHandle operationHandle
}
struct TGetPrimaryKeysReq {
// Session to run this request against
1: required TSessionHandle sessionHandle
// Name of the catalog.
2: optional TIdentifier catalogName
// Name of the schema.
3: optional TIdentifier schemaName
// Name of the table.
4: optional TIdentifier tableName
}
struct TGetPrimaryKeysResp {
1: required TStatus status
2: optional TOperationHandle operationHandle
}
struct TGetCrossReferenceReq {
// Session to run this request against
1: required TSessionHandle sessionHandle
// Name of the parent catalog.
2: optional TIdentifier parentCatalogName
// Name of the parent schema.
3: optional TIdentifier parentSchemaName