-
Notifications
You must be signed in to change notification settings - Fork 4.7k
/
hive_metastore.thrift
3364 lines (2875 loc) · 120 KB
/
hive_metastore.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
#!/usr/local/bin/thrift -java
/**
* 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.
*/
#
# Thrift Service that the MetaStore is built on
#
include "share/fb303/if/fb303.thrift"
namespace java org.apache.hadoop.hive.metastore.api
namespace php metastore
namespace cpp Apache.Hadoop.Hive
const string DDL_TIME = "transient_lastDdlTime"
const byte ACCESSTYPE_NONE = 1;
const byte ACCESSTYPE_READONLY = 2;
const byte ACCESSTYPE_WRITEONLY = 4;
const byte ACCESSTYPE_READWRITE = 8;
struct Version {
1: string version,
2: string comments
}
struct FieldSchema {
1: string name, // name of the field
2: string type, // type of the field. primitive types defined above, specify list<TYPE_NAME>, map<TYPE_NAME, TYPE_NAME> for lists & maps
3: string comment
}
// Key-value store to be used with selected
// Metastore APIs (create, alter methods).
// The client can pass environment properties / configs that can be
// accessed in hooks.
struct EnvironmentContext {
1: map<string, string> properties
}
struct SQLPrimaryKey {
1: string table_db, // table schema
2: string table_name, // table name
3: string column_name, // column name
4: i32 key_seq, // sequence number within primary key
5: string pk_name, // primary key name
6: bool enable_cstr, // Enable/Disable
7: bool validate_cstr, // Validate/No validate
8: bool rely_cstr, // Rely/No Rely
9: optional string catName
}
struct SQLForeignKey {
1: string pktable_db, // primary key table schema
2: string pktable_name, // primary key table name
3: string pkcolumn_name, // primary key column name
4: string fktable_db, // foreign key table schema
5: string fktable_name, // foreign key table name
6: string fkcolumn_name, // foreign key column name
7: i32 key_seq, // sequence within foreign key
8: i32 update_rule, // what happens to foreign key when parent key is updated
9: i32 delete_rule, // what happens to foreign key when parent key is deleted
10: string fk_name, // foreign key name
11: string pk_name, // primary key name
12: bool enable_cstr, // Enable/Disable
13: bool validate_cstr, // Validate/No validate
14: bool rely_cstr, // Rely/No Rely
15: optional string catName
}
struct SQLUniqueConstraint {
1: string catName, // table catalog
2: string table_db, // table schema
3: string table_name, // table name
4: string column_name, // column name
5: i32 key_seq, // sequence number within unique constraint
6: string uk_name, // unique key name
7: bool enable_cstr, // Enable/Disable
8: bool validate_cstr, // Validate/No validate
9: bool rely_cstr, // Rely/No Rely
}
struct SQLNotNullConstraint {
1: string catName, // table catalog
2: string table_db, // table schema
3: string table_name, // table name
4: string column_name, // column name
5: string nn_name, // not null name
6: bool enable_cstr, // Enable/Disable
7: bool validate_cstr, // Validate/No validate
8: bool rely_cstr, // Rely/No Rely
}
struct SQLDefaultConstraint {
1: string catName, // catalog name
2: string table_db, // table schema
3: string table_name, // table name
4: string column_name, // column name
5: string default_value,// default value
6: string dc_name, // default name
7: bool enable_cstr, // Enable/Disable
8: bool validate_cstr, // Validate/No validate
9: bool rely_cstr // Rely/No Rely
}
struct SQLCheckConstraint {
1: string catName, // catalog name
2: string table_db, // table schema
3: string table_name, // table name
4: string column_name, // column name
5: string check_expression,// check expression
6: string dc_name, // default name
7: bool enable_cstr, // Enable/Disable
8: bool validate_cstr, // Validate/No validate
9: bool rely_cstr // Rely/No Rely
}
struct SQLAllTableConstraints {
1: optional list<SQLPrimaryKey> primaryKeys,
2: optional list<SQLForeignKey> foreignKeys,
3: optional list<SQLUniqueConstraint> uniqueConstraints,
4: optional list<SQLNotNullConstraint> notNullConstraints,
5: optional list<SQLDefaultConstraint> defaultConstraints,
6: optional list<SQLCheckConstraint> checkConstraints
}
struct Type {
1: string name, // one of the types in PrimitiveTypes or CollectionTypes or User defined types
2: optional string type1, // object type if the name is 'list' (LIST_TYPE), key type if the name is 'map' (MAP_TYPE)
3: optional string type2, // val type if the name is 'map' (MAP_TYPE)
4: optional list<FieldSchema> fields // if the name is one of the user defined types
}
enum HiveObjectType {
GLOBAL = 1,
DATABASE = 2,
TABLE = 3,
PARTITION = 4,
COLUMN = 5,
DATACONNECTOR = 6,
}
enum PrincipalType {
USER = 1,
ROLE = 2,
GROUP = 3,
}
const string HIVE_FILTER_FIELD_OWNER = "hive_filter_field_owner__"
const string HIVE_FILTER_FIELD_PARAMS = "hive_filter_field_params__"
const string HIVE_FILTER_FIELD_LAST_ACCESS = "hive_filter_field_last_access__"
const string HIVE_FILTER_FIELD_TABLE_NAME = "hive_filter_field_tableName__"
const string HIVE_FILTER_FIELD_TABLE_TYPE = "hive_filter_field_tableType__"
struct PropertySetRequest {
1: required string nameSpace;
2: map<string, string> propertyMap;
}
struct PropertyGetRequest {
1: required string nameSpace;
2: string mapPrefix;
3: optional string mapPredicate;
4: optional list<string> mapSelection;
}
struct PropertyGetResponse {
1: map<string, map<string , string>> properties;
}
enum PartitionEventType {
LOAD_DONE = 1,
}
// Enums for transaction and lock management
enum TxnState {
COMMITTED = 1,
ABORTED = 2,
OPEN = 3,
}
enum LockLevel {
DB = 1,
TABLE = 2,
PARTITION = 3,
}
enum LockState {
ACQUIRED = 1, // requester has the lock
WAITING = 2, // requester is waiting for the lock and should call checklock at a later point to see if the lock has been obtained.
ABORT = 3, // the lock has been aborted, most likely due to timeout
NOT_ACQUIRED = 4, // returned only with lockNoWait, indicates the lock was not available and was not acquired
}
enum LockType {
SHARED_READ = 1,
SHARED_WRITE = 2,
EXCLUSIVE = 3,
EXCL_WRITE = 4,
}
enum CompactionType {
MINOR = 1,
MAJOR = 2,
REBALANCE = 3,
ABORT_TXN_CLEANUP = 4,
}
enum GrantRevokeType {
GRANT = 1,
REVOKE = 2,
}
enum DataOperationType {
SELECT = 1,
INSERT = 2
UPDATE = 3,
DELETE = 4,
UNSET = 5,//this is the default to distinguish from NULL from old clients
NO_TXN = 6,//drop table, insert overwrite, etc - something non-transactional
}
// Types of events the client can request that the metastore fire. For now just support DML operations, as the metastore knows
// about DDL operations and there's no reason for the client to request such an event.
enum EventRequestType {
INSERT = 1,
UPDATE = 2,
DELETE = 3,
}
enum SerdeType {
HIVE = 1,
SCHEMA_REGISTRY = 2,
}
enum SchemaType {
HIVE = 1,
AVRO = 2,
}
enum SchemaCompatibility {
NONE = 1,
BACKWARD = 2,
FORWARD = 3,
BOTH = 4
}
enum SchemaValidation {
LATEST = 1,
ALL = 2
}
enum SchemaVersionState {
INITIATED = 1,
START_REVIEW = 2,
CHANGES_REQUIRED = 3,
REVIEWED = 4,
ENABLED = 5,
DISABLED = 6,
ARCHIVED = 7,
DELETED = 8
}
enum DatabaseType {
NATIVE = 1,
REMOTE = 2
}
struct HiveObjectRef{
1: HiveObjectType objectType,
2: string dbName,
3: string objectName,
4: list<string> partValues,
5: string columnName,
6: optional string catName
}
struct PrivilegeGrantInfo {
1: string privilege,
2: i32 createTime,
3: string grantor,
4: PrincipalType grantorType,
5: bool grantOption,
}
struct HiveObjectPrivilege {
1: HiveObjectRef hiveObject,
2: string principalName,
3: PrincipalType principalType,
4: PrivilegeGrantInfo grantInfo,
5: string authorizer,
}
struct PrivilegeBag {
1: list<HiveObjectPrivilege> privileges,
}
struct PrincipalPrivilegeSet {
1: map<string, list<PrivilegeGrantInfo>> userPrivileges, // user name -> privilege grant info
2: map<string, list<PrivilegeGrantInfo>> groupPrivileges, // group name -> privilege grant info
3: map<string, list<PrivilegeGrantInfo>> rolePrivileges, //role name -> privilege grant info
}
struct GrantRevokePrivilegeRequest {
1: GrantRevokeType requestType;
2: PrivilegeBag privileges;
3: optional bool revokeGrantOption; // Only for revoke request
}
struct GrantRevokePrivilegeResponse {
1: optional bool success;
}
struct TruncateTableRequest {
1: required string dbName,
2: required string tableName,
3: optional list<string> partNames,
4: optional i64 writeId=-1,
5: optional string validWriteIdList,
6: optional EnvironmentContext environmentContext
}
struct TruncateTableResponse {
}
struct Role {
1: string roleName,
2: i32 createTime,
3: string ownerName,
}
// Representation of a grant for a principal to a role
struct RolePrincipalGrant {
1: string roleName,
2: string principalName,
3: PrincipalType principalType,
4: bool grantOption,
5: i32 grantTime,
6: string grantorName,
7: PrincipalType grantorPrincipalType
}
struct GetRoleGrantsForPrincipalRequest {
1: required string principal_name,
2: required PrincipalType principal_type
}
struct GetRoleGrantsForPrincipalResponse {
1: required list<RolePrincipalGrant> principalGrants;
}
struct GetPrincipalsInRoleRequest {
1: required string roleName;
}
struct GetPrincipalsInRoleResponse {
1: required list<RolePrincipalGrant> principalGrants;
}
struct GrantRevokeRoleRequest {
1: GrantRevokeType requestType;
2: string roleName;
3: string principalName;
4: PrincipalType principalType;
5: optional string grantor; // Needed for grant
6: optional PrincipalType grantorType; // Needed for grant
7: optional bool grantOption;
}
struct GrantRevokeRoleResponse {
1: optional bool success;
}
struct Catalog {
1: string name, // Name of the catalog
2: optional string description, // description of the catalog
3: string locationUri, // default storage location. When databases are created in
// this catalog, if they do not specify a location, they will
// be placed in this location.
4: optional i32 createTime // creation time of catalog in seconds since epoch
}
struct CreateCatalogRequest {
1: Catalog catalog
}
struct AlterCatalogRequest {
1: string name,
2: Catalog newCat
}
struct GetCatalogRequest {
1: string name
}
struct GetCatalogResponse {
1: Catalog catalog
}
struct GetCatalogsResponse {
1: list<string> names
}
struct DropCatalogRequest {
1: string name,
2: optional bool ifExists
}
// namespace for tables
struct Database {
1: string name,
2: string description,
3: string locationUri,
4: map<string, string> parameters, // properties associated with the database
5: optional PrincipalPrivilegeSet privileges,
6: optional string ownerName,
7: optional PrincipalType ownerType,
8: optional string catalogName,
9: optional i32 createTime, // creation time of database in seconds since epoch
10: optional string managedLocationUri, // directory for managed tables
11: optional DatabaseType type,
12: optional string connector_name,
13: optional string remote_dbname
}
// This object holds the information needed by SerDes
struct SerDeInfo {
1: string name, // name of the serde, table name by default
2: string serializationLib, // usually the class that implements the extractor & loader
3: map<string, string> parameters, // initialization parameters
4: optional string description,
5: optional string serializerClass,
6: optional string deserializerClass,
7: optional SerdeType serdeType
}
// sort order of a column (column name along with asc(1)/desc(0))
struct Order {
1: string col, // sort column name
2: i32 order // asc(1) or desc(0)
}
// this object holds all the information about skewed table
struct SkewedInfo {
1: list<string> skewedColNames, // skewed column names
2: list<list<string>> skewedColValues, //skewed values
3: map<list<string>, string> skewedColValueLocationMaps, //skewed value to location mappings
}
// this object holds all the information about physical storage of the data belonging to a table
struct StorageDescriptor {
1: list<FieldSchema> cols, // required (refer to types defined above)
2: string location, // defaults to <warehouse loc>/<db loc>/tablename
3: string inputFormat, // SequenceFileInputFormat (binary) or TextInputFormat` or custom format
4: string outputFormat, // SequenceFileOutputFormat (binary) or IgnoreKeyTextOutputFormat or custom format
5: bool compressed, // compressed or not
6: i32 numBuckets, // this must be specified if there are any dimension columns
7: SerDeInfo serdeInfo, // serialization and deserialization information
8: list<string> bucketCols, // reducer grouping columns and clustering columns and bucketing columns`
9: list<Order> sortCols, // sort order of the data in each bucket
10: map<string, string> parameters, // any user supplied key value hash
11: optional SkewedInfo skewedInfo, // skewed information
12: optional bool storedAsSubDirectories // stored as subdirectories or not
}
struct CreationMetadata {
1: required string catName,
2: required string dbName,
3: required string tblName,
4: required set<string> tablesUsed,
5: optional string validTxnList,
6: optional i64 materializationTime,
7: optional list<SourceTable> sourceTables
}
// column statistics
struct BooleanColumnStatsData {
1: required i64 numTrues,
2: required i64 numFalses,
3: required i64 numNulls,
4: optional binary bitVectors
}
struct DoubleColumnStatsData {
1: optional double lowValue,
2: optional double highValue,
3: required i64 numNulls,
4: required i64 numDVs,
5: optional binary bitVectors,
6: optional binary histogram
}
struct LongColumnStatsData {
1: optional i64 lowValue,
2: optional i64 highValue,
3: required i64 numNulls,
4: required i64 numDVs,
5: optional binary bitVectors,
6: optional binary histogram
}
struct StringColumnStatsData {
1: required i64 maxColLen,
2: required double avgColLen,
3: required i64 numNulls,
4: required i64 numDVs,
5: optional binary bitVectors
}
struct BinaryColumnStatsData {
1: required i64 maxColLen,
2: required double avgColLen,
3: required i64 numNulls,
4: optional binary bitVectors
}
struct Decimal {
3: required i16 scale, // force using scale first in Decimal.compareTo
1: required binary unscaled
}
struct DecimalColumnStatsData {
1: optional Decimal lowValue,
2: optional Decimal highValue,
3: required i64 numNulls,
4: required i64 numDVs,
5: optional binary bitVectors,
6: optional binary histogram
}
struct Date {
1: required i64 daysSinceEpoch
}
struct DateColumnStatsData {
1: optional Date lowValue,
2: optional Date highValue,
3: required i64 numNulls,
4: required i64 numDVs,
5: optional binary bitVectors,
6: optional binary histogram
}
struct Timestamp {
1: required i64 secondsSinceEpoch
}
struct TimestampColumnStatsData {
1: optional Timestamp lowValue,
2: optional Timestamp highValue,
3: required i64 numNulls,
4: required i64 numDVs,
5: optional binary bitVectors,
6: optional binary histogram
}
union ColumnStatisticsData {
1: BooleanColumnStatsData booleanStats,
2: LongColumnStatsData longStats,
3: DoubleColumnStatsData doubleStats,
4: StringColumnStatsData stringStats,
5: BinaryColumnStatsData binaryStats,
6: DecimalColumnStatsData decimalStats,
7: DateColumnStatsData dateStats,
8: TimestampColumnStatsData timestampStats
}
struct ColumnStatisticsObj {
1: required string colName,
2: required string colType,
3: required ColumnStatisticsData statsData
}
struct ColumnStatisticsDesc {
1: required bool isTblLevel,
2: required string dbName,
3: required string tableName,
4: optional string partName,
5: optional i64 lastAnalyzed,
6: optional string catName
}
struct ColumnStatistics {
1: required ColumnStatisticsDesc statsDesc,
2: required list<ColumnStatisticsObj> statsObj,
3: optional bool isStatsCompliant, // Are the stats isolation-level-compliant with the
// the calling query?
4: optional string engine = "hive"
}
// FileMetadata represents the table-level (in case of unpartitioned) or partition-level
// file metadata. Each partition could have more than 1 files and hence the list of
// binary data field. Each value in data field corresponds to metadata for one file.
struct FileMetadata {
// current supported type mappings are
// 1 -> IMPALA
1: byte type = 1
2: byte version = 1
3: list<binary> data
}
// this field can be used to store repeatitive information
// (like network addresses in filemetadata). Instead of
// sending the same object repeatedly, we can send the indices
// corresponding to the object in this list.
struct ObjectDictionary {
// the key can be used to determine the object type
// the value is the list of the objects which can be accessed
// using their indices. These indices can be used to send instead of
// full object which can reduce the payload significantly in case of
// repetitive objects.
1: required map<string, list<binary>> values
}
// table information
struct Table {
1: string tableName, // name of the table
2: string dbName, // database name ('default')
3: string owner, // owner of this table
4: i32 createTime, // creation time of the table
5: i32 lastAccessTime, // last access time (usually this will be filled from HDFS and shouldn't be relied on)
6: i32 retention, // retention time
7: StorageDescriptor sd, // storage descriptor of the table
8: list<FieldSchema> partitionKeys, // partition keys of the table. only primitive types are supported
9: map<string, string> parameters, // to store comments or any other user level parameters
10: string viewOriginalText, // original view text, null for non-view
11: string viewExpandedText, // expanded view text, null for non-view
12: string tableType, // table type enum, e.g. EXTERNAL_TABLE
13: optional PrincipalPrivilegeSet privileges,
14: optional bool temporary=false,
15: optional bool rewriteEnabled, // rewrite enabled or not
16: optional CreationMetadata creationMetadata, // only for MVs, it stores table names used and txn list at MV creation
17: optional string catName, // Name of the catalog the table is in
18: optional PrincipalType ownerType = PrincipalType.USER, // owner type of this table (default to USER for backward compatibility)
19: optional i64 writeId=-1,
20: optional bool isStatsCompliant,
21: optional ColumnStatistics colStats, // column statistics for table
22: optional byte accessType,
23: optional list<string> requiredReadCapabilities,
24: optional list<string> requiredWriteCapabilities
25: optional i64 id, // id of the table. It will be ignored if set. It's only for
// read purposes
26: optional FileMetadata fileMetadata, // optional serialized file-metadata for this table
// for certain execution engines
27: optional ObjectDictionary dictionary,
28: optional i64 txnId, // txnId associated with the table creation
}
struct SourceTable {
1: required Table table,
2: required i64 insertedCount,
3: required i64 updatedCount,
4: required i64 deletedCount
}
struct Partition {
1: list<string> values // string value is converted to appropriate partition key type
2: string dbName,
3: string tableName,
4: i32 createTime,
5: i32 lastAccessTime,
6: StorageDescriptor sd,
7: map<string, string> parameters,
8: optional PrincipalPrivilegeSet privileges,
9: optional string catName,
10: optional i64 writeId=-1,
11: optional bool isStatsCompliant,
12: optional ColumnStatistics colStats, // column statistics for partition
13: optional FileMetadata fileMetadata // optional serialized file-metadata useful for certain execution engines
}
struct PartitionWithoutSD {
1: list<string> values // string value is converted to appropriate partition key type
2: i32 createTime,
3: i32 lastAccessTime,
4: string relativePath,
5: map<string, string> parameters,
6: optional PrincipalPrivilegeSet privileges
}
struct PartitionSpecWithSharedSD {
1: list<PartitionWithoutSD> partitions,
2: StorageDescriptor sd,
}
struct PartitionListComposingSpec {
1: list<Partition> partitions
}
struct PartitionSpec {
1: string dbName,
2: string tableName,
3: string rootPath,
4: optional PartitionSpecWithSharedSD sharedSDPartitionSpec,
5: optional PartitionListComposingSpec partitionList,
6: optional string catName,
7: optional i64 writeId=-1,
8: optional bool isStatsCompliant
}
struct AggrStats {
1: required list<ColumnStatisticsObj> colStats,
2: required i64 partsFound, // number of partitions for which stats were found
3: optional bool isStatsCompliant
}
struct SetPartitionsStatsRequest {
1: required list<ColumnStatistics> colStats,
2: optional bool needMerge, //stats need to be merged with the existing stats
3: optional i64 writeId=-1, // writeId for the current query that updates the stats
4: optional string validWriteIdList, // valid write id list for the table for which this struct is being sent
5: optional string engine = "hive" //engine creating the current request
}
struct SetPartitionsStatsResponse {
1: required bool result;
}
// schema of the table/query results etc.
struct Schema {
// column names, types, comments
1: list<FieldSchema> fieldSchemas, // delimiters etc
2: map<string, string> properties
}
struct PrimaryKeysRequest {
1: required string db_name,
2: required string tbl_name,
3: optional string catName,
4: optional string validWriteIdList,
5: optional i64 tableId=-1
}
struct PrimaryKeysResponse {
1: required list<SQLPrimaryKey> primaryKeys
}
struct ForeignKeysRequest {
1: string parent_db_name,
2: string parent_tbl_name,
3: string foreign_db_name,
4: string foreign_tbl_name,
5: optional string catName, // No cross catalog constraints
6: optional string validWriteIdList,
7: optional i64 tableId=-1
}
struct ForeignKeysResponse {
1: required list<SQLForeignKey> foreignKeys
}
struct UniqueConstraintsRequest {
1: required string catName,
2: required string db_name,
3: required string tbl_name,
4: optional string validWriteIdList,
5: optional i64 tableId=-1
}
struct UniqueConstraintsResponse {
1: required list<SQLUniqueConstraint> uniqueConstraints
}
struct NotNullConstraintsRequest {
1: required string catName,
2: required string db_name,
3: required string tbl_name,
4: optional string validWriteIdList,
5: optional i64 tableId=-1
}
struct NotNullConstraintsResponse {
1: required list<SQLNotNullConstraint> notNullConstraints
}
struct DefaultConstraintsRequest {
1: required string catName,
2: required string db_name,
3: required string tbl_name,
4: optional string validWriteIdList,
5: optional i64 tableId=-1
}
struct DefaultConstraintsResponse {
1: required list<SQLDefaultConstraint> defaultConstraints
}
struct CheckConstraintsRequest {
1: required string catName,
2: required string db_name,
3: required string tbl_name,
4: optional string validWriteIdList,
5: optional i64 tableId=-1
}
struct CheckConstraintsResponse {
1: required list<SQLCheckConstraint> checkConstraints
}
struct AllTableConstraintsRequest {
1: required string dbName,
2: required string tblName,
3: required string catName,
4: optional string validWriteIdList,
5: optional i64 tableId=-1
}
struct AllTableConstraintsResponse {
1: required SQLAllTableConstraints allTableConstraints
}
struct DropConstraintRequest {
1: required string dbname,
2: required string tablename,
3: required string constraintname,
4: optional string catName
}
struct AddPrimaryKeyRequest {
1: required list<SQLPrimaryKey> primaryKeyCols
}
struct AddForeignKeyRequest {
1: required list<SQLForeignKey> foreignKeyCols
}
struct AddUniqueConstraintRequest {
1: required list<SQLUniqueConstraint> uniqueConstraintCols
}
struct AddNotNullConstraintRequest {
1: required list<SQLNotNullConstraint> notNullConstraintCols
}
struct AddDefaultConstraintRequest {
1: required list<SQLDefaultConstraint> defaultConstraintCols
}
struct AddCheckConstraintRequest {
1: required list<SQLCheckConstraint> checkConstraintCols
}
// Return type for get_partitions_by_expr
struct PartitionsByExprResult {
1: required list<Partition> partitions,
// Whether the results has any (currently, all) partitions which may or may not match
2: required bool hasUnknownPartitions
}
// Return type for get_partitions_spec_by_expr
struct PartitionsSpecByExprResult {
1: required list<PartitionSpec> partitionsSpec,
// Whether the results has any (currently, all) partitions which may or may not match
2: required bool hasUnknownPartitions
}
struct PartitionsByExprRequest {
1: required string dbName,
2: required string tblName,
3: required binary expr,
4: optional string defaultPartitionName,
5: optional i16 maxParts=-1,
6: optional string catName,
7: optional string order
8: optional string validWriteIdList,
9: optional i64 id=-1, // table id
10: optional bool skipColumnSchemaForPartition,
11: optional string includeParamKeyPattern,
12: optional string excludeParamKeyPattern
}
struct TableStatsResult {
1: required list<ColumnStatisticsObj> tableStats,
2: optional bool isStatsCompliant
}
struct PartitionsStatsResult {
1: required map<string, list<ColumnStatisticsObj>> partStats,
2: optional bool isStatsCompliant
}
struct TableStatsRequest {
1: required string dbName,
2: required string tblName,
3: required list<string> colNames
4: optional string catName,
5: optional string validWriteIdList, // valid write id list for the table for which this struct is being sent
6: optional string engine = "hive", //engine creating the current request
7: optional i64 id=-1 // table id
}
struct PartitionsStatsRequest {
1: required string dbName,
2: required string tblName,
3: required list<string> colNames,
4: required list<string> partNames,
5: optional string catName,
6: optional string validWriteIdList, // valid write id list for the table for which this struct is being sent
7: optional string engine = "hive" //engine creating the current request
}
// Return type for add_partitions_req
struct AddPartitionsResult {
1: optional list<Partition> partitions,
2: optional bool isStatsCompliant,
3: optional list<FieldSchema> partitionColSchema
}
// Request type for add_partitions_req
struct AddPartitionsRequest {
1: required string dbName,
2: required string tblName,
3: required list<Partition> parts,
4: required bool ifNotExists,
5: optional bool needResult=true,
6: optional string catName,
7: optional string validWriteIdList,
8: optional bool skipColumnSchemaForPartition,
9: optional list<FieldSchema> partitionColSchema,
10: optional EnvironmentContext environmentContext
}
// Return type for drop_partitions_req
struct DropPartitionsResult {
1: optional list<Partition> partitions,
}
struct DropPartitionsExpr {
1: required binary expr;
2: optional i32 partArchiveLevel;
}
union RequestPartsSpec {
1: list<string> names;
2: list<DropPartitionsExpr> exprs;
}
// Request type for drop_partitions_req
// TODO: we might want to add "bestEffort" flag; where a subset can fail
struct DropPartitionsRequest {
1: required string dbName,
2: required string tblName,
3: required RequestPartsSpec parts,
4: optional bool deleteData,
5: optional bool ifExists=true, // currently verified on client
6: optional bool ignoreProtection,
7: optional EnvironmentContext environmentContext,
8: optional bool needResult=true,
9: optional string catName,
10: optional bool skipColumnSchemaForPartition
}
struct DropPartitionRequest {
1: optional string catName,
2: required string dbName,
3: required string tblName,
4: optional string partName,
5: optional list<string> partVals,
6: optional bool deleteData,
7: optional EnvironmentContext environmentContext
}
struct PartitionValuesRequest {
1: required string dbName,
2: required string tblName,
3: required list<FieldSchema> partitionKeys;
4: optional bool applyDistinct = true;
5: optional string filter;
6: optional list<FieldSchema> partitionOrder;
7: optional bool ascending = true;
8: optional i64 maxParts = -1;
9: optional string catName,
10: optional string validWriteIdList
}
struct PartitionValuesRow {
1: required list<string> row;
}
struct PartitionValuesResponse {
1: required list<PartitionValuesRow> partitionValues;
}