github.com/treeverse/lakefs@v1.24.1-0.20240520134607-95648127bfb0/pkg/metastore/hive/hive_metastore.thrift (about) 1 /**/#!/usr/local/bin/thrift -java 2 3 /** 4 * Licensed to the Apache Software Foundation (ASF) under one 5 * or more contributor license agreements. See the NOTICE file 6 * distributed with this work for additional information 7 * regarding copyright ownership. The ASF licenses this file 8 * to you under the Apache License, Version 2.0 (the 9 * "License"); you may not use this file except in compliance 10 * with the License. You may obtain a copy of the License at 11 * 12 * http://www.apache.org/licenses/LICENSE-2.0 13 * 14 * Unless required by applicable law or agreed to in writing, software 15 * distributed under the License is distributed on an "AS IS" BASIS, 16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 * See the License for the specific language governing permissions and 18 * limitations under the License. 19 */ 20 21 # 22 # Thrift Service that the MetaStore is built on 23 # 24 25 namespace java org.apache.hadoop.hive.metastore.api 26 namespace php metastore 27 namespace cpp Apache.Hadoop.Hive 28 29 const string DDL_TIME = "transient_lastDdlTime" 30 31 struct Version { 32 1: string version, 33 2: string comments 34 } 35 36 struct FieldSchema { 37 1: string name, // name of the field 38 2: string type, // type of the field. primitive types defined above, specify list<TYPE_NAME>, map<TYPE_NAME, TYPE_NAME> for lists & maps 39 3: string comment 40 } 41 42 struct SQLPrimaryKey { 43 1: string table_db, // table schema 44 2: string table_name, // table name 45 3: string column_name, // column name 46 4: i32 key_seq, // sequence number within primary key 47 5: string pk_name, // primary key name 48 6: bool enable_cstr, // Enable/Disable 49 7: bool validate_cstr, // Validate/No validate 50 8: bool rely_cstr // Rely/No Rely 51 } 52 53 struct SQLForeignKey { 54 1: string pktable_db, // primary key table schema 55 2: string pktable_name, // primary key table name 56 3: string pkcolumn_name, // primary key column name 57 4: string fktable_db, // foreign key table schema 58 5: string fktable_name, // foreign key table name 59 6: string fkcolumn_name, // foreign key column name 60 7: i32 key_seq, // sequence within foreign key 61 8: i32 update_rule, // what happens to foreign key when parent key is updated 62 9: i32 delete_rule, // what happens to foreign key when parent key is deleted 63 10: string fk_name, // foreign key name 64 11: string pk_name, // primary key name 65 12: bool enable_cstr, // Enable/Disable 66 13: bool validate_cstr, // Validate/No validate 67 14: bool rely_cstr // Rely/No Rely 68 } 69 70 struct SQLUniqueConstraint { 71 1: string table_db, // table schema 72 2: string table_name, // table name 73 3: string column_name, // column name 74 4: i32 key_seq, // sequence number within unique constraint 75 5: string uk_name, // unique key name 76 6: bool enable_cstr, // Enable/Disable 77 7: bool validate_cstr, // Validate/No validate 78 8: bool rely_cstr // Rely/No Rely 79 } 80 81 struct SQLNotNullConstraint { 82 1: string table_db, // table schema 83 2: string table_name, // table name 84 3: string column_name, // column name 85 4: string nn_name, // not null name 86 5: bool enable_cstr, // Enable/Disable 87 6: bool validate_cstr, // Validate/No validate 88 7: bool rely_cstr // Rely/No Rely 89 } 90 91 struct Type { 92 1: string name, // one of the types in PrimitiveTypes or CollectionTypes or User defined types 93 2: optional string type1, // object type if the name is 'list' (LIST_TYPE), key type if the name is 'map' (MAP_TYPE) 94 3: optional string type2, // val type if the name is 'map' (MAP_TYPE) 95 4: optional list<FieldSchema> fields // if the name is one of the user defined types 96 } 97 98 enum HiveObjectType { 99 GLOBAL = 1, 100 DATABASE = 2, 101 TABLE = 3, 102 PARTITION = 4, 103 COLUMN = 5, 104 } 105 106 enum PrincipalType { 107 USER = 1, 108 ROLE = 2, 109 GROUP = 3, 110 } 111 112 const string HIVE_FILTER_FIELD_OWNER = "hive_filter_field_owner__" 113 const string HIVE_FILTER_FIELD_PARAMS = "hive_filter_field_params__" 114 const string HIVE_FILTER_FIELD_LAST_ACCESS = "hive_filter_field_last_access__" 115 116 enum PartitionEventType { 117 LOAD_DONE = 1, 118 } 119 120 // Enums for transaction and lock management 121 enum TxnState { 122 COMMITTED = 1, 123 ABORTED = 2, 124 OPEN = 3, 125 } 126 127 enum LockLevel { 128 DB = 1, 129 TABLE = 2, 130 PARTITION = 3, 131 } 132 133 enum LockState { 134 ACQUIRED = 1, // requester has the lock 135 WAITING = 2, // requester is waiting for the lock and should call checklock at a later point to see if the lock has been obtained. 136 ABORT = 3, // the lock has been aborted, most likely due to timeout 137 NOT_ACQUIRED = 4, // returned only with lockNoWait, indicates the lock was not available and was not acquired 138 } 139 140 enum LockType { 141 SHARED_READ = 1, 142 SHARED_WRITE = 2, 143 EXCLUSIVE = 3, 144 } 145 146 enum CompactionType { 147 MINOR = 1, 148 MAJOR = 2, 149 } 150 151 enum GrantRevokeType { 152 GRANT = 1, 153 REVOKE = 2, 154 } 155 156 enum DataOperationType { 157 SELECT = 1, 158 INSERT = 2 159 UPDATE = 3, 160 DELETE = 4, 161 UNSET = 5,//this is the default to distinguish from NULL from old clients 162 NO_TXN = 6,//drop table, insert overwrite, etc - something non-transactional 163 } 164 165 // Types of events the client can request that the metastore fire. For now just support DML operations, as the metastore knows 166 // about DDL operations and there's no reason for the client to request such an event. 167 enum EventRequestType { 168 INSERT = 1, 169 UPDATE = 2, 170 DELETE = 3, 171 } 172 173 struct HiveObjectRef{ 174 1: HiveObjectType objectType, 175 2: string dbName, 176 3: string objectName, 177 4: list<string> partValues, 178 5: string columnName, 179 } 180 181 struct PrivilegeGrantInfo { 182 1: string privilege, 183 2: i32 createTime, 184 3: string grantor, 185 4: PrincipalType grantorType, 186 5: bool grantOption, 187 } 188 189 struct HiveObjectPrivilege { 190 1: HiveObjectRef hiveObject, 191 2: string principalName, 192 3: PrincipalType principalType, 193 4: PrivilegeGrantInfo grantInfo, 194 } 195 196 struct PrivilegeBag { 197 1: list<HiveObjectPrivilege> privileges, 198 } 199 200 struct PrincipalPrivilegeSet { 201 1: map<string, list<PrivilegeGrantInfo>> userPrivileges, // user name -> privilege grant info 202 2: map<string, list<PrivilegeGrantInfo>> groupPrivileges, // group name -> privilege grant info 203 3: map<string, list<PrivilegeGrantInfo>> rolePrivileges, //role name -> privilege grant info 204 } 205 206 struct GrantRevokePrivilegeRequest { 207 1: GrantRevokeType requestType; 208 2: PrivilegeBag privileges; 209 3: optional bool revokeGrantOption; // Only for revoke request 210 } 211 212 struct GrantRevokePrivilegeResponse { 213 1: optional bool success; 214 } 215 216 struct Role { 217 1: string roleName, 218 2: i32 createTime, 219 3: string ownerName, 220 } 221 222 // Representation of a grant for a principal to a role 223 struct RolePrincipalGrant { 224 1: string roleName, 225 2: string principalName, 226 3: PrincipalType principalType, 227 4: bool grantOption, 228 5: i32 grantTime, 229 6: string grantorName, 230 7: PrincipalType grantorPrincipalType 231 } 232 233 struct GetRoleGrantsForPrincipalRequest { 234 1: required string principal_name, 235 2: required PrincipalType principal_type 236 } 237 238 struct GetRoleGrantsForPrincipalResponse { 239 1: required list<RolePrincipalGrant> principalGrants; 240 } 241 242 struct GetPrincipalsInRoleRequest { 243 1: required string roleName; 244 } 245 246 struct GetPrincipalsInRoleResponse { 247 1: required list<RolePrincipalGrant> principalGrants; 248 } 249 250 struct GrantRevokeRoleRequest { 251 1: GrantRevokeType requestType; 252 2: string roleName; 253 3: string principalName; 254 4: PrincipalType principalType; 255 5: optional string grantor; // Needed for grant 256 6: optional PrincipalType grantorType; // Needed for grant 257 7: optional bool grantOption; 258 } 259 260 struct GrantRevokeRoleResponse { 261 1: optional bool success; 262 } 263 264 // namespace for tables 265 struct Database { 266 1: string name, 267 2: string description, 268 3: string locationUri, 269 4: map<string, string> parameters, // properties associated with the database 270 5: optional PrincipalPrivilegeSet privileges, 271 6: optional string ownerName, 272 7: optional PrincipalType ownerType 273 } 274 275 // This object holds the information needed by SerDes 276 struct SerDeInfo { 277 1: string name, // name of the serde, table name by default 278 2: string serializationLib, // usually the class that implements the extractor & loader 279 3: map<string, string> parameters // initialization parameters 280 } 281 282 // sort order of a column (column name along with asc(1)/desc(0)) 283 struct Order { 284 1: string col, // sort column name 285 2: i32 order // asc(1) or desc(0) 286 } 287 288 // this object holds all the information about skewed table 289 struct SkewedInfo { 290 1: list<string> skewedColNames, // skewed column names 291 2: list<list<string>> skewedColValues, //skewed values 292 3: map<string, string> skewedColValueLocationMaps, //skewed value to location mappings 293 } 294 295 // this object holds all the information about physical storage of the data belonging to a table 296 struct StorageDescriptor { 297 1: list<FieldSchema> cols, // required (refer to types defined above) 298 2: string location, // defaults to <warehouse loc>/<db loc>/tablename 299 3: string inputFormat, // SequenceFileInputFormat (binary) or TextInputFormat` or custom format 300 4: string outputFormat, // SequenceFileOutputFormat (binary) or IgnoreKeyTextOutputFormat or custom format 301 5: bool compressed, // compressed or not 302 6: i32 numBuckets, // this must be specified if there are any dimension columns 303 7: SerDeInfo serdeInfo, // serialization and deserialization information 304 8: list<string> bucketCols, // reducer grouping columns and clustering columns and bucketing columns` 305 9: list<Order> sortCols, // sort order of the data in each bucket 306 10: map<string, string> parameters, // any user supplied key value hash 307 11: optional SkewedInfo skewedInfo, // skewed information 308 12: optional bool storedAsSubDirectories // stored as subdirectories or not 309 } 310 311 // table information 312 struct Table { 313 1: string tableName, // name of the table 314 2: string dbName, // database name ('default') 315 3: string owner, // owner of this table 316 4: i32 createTime, // creation time of the table 317 5: i32 lastAccessTime, // last access time (usually this will be filled from HDFS and shouldn't be relied on) 318 6: i32 retention, // retention time 319 7: StorageDescriptor sd, // storage descriptor of the table 320 8: list<FieldSchema> partitionKeys, // partition keys of the table. only primitive types are supported 321 9: map<string, string> parameters, // to store comments or any other user level parameters 322 10: string viewOriginalText, // original view text, null for non-view 323 11: string viewExpandedText, // expanded view text, null for non-view 324 12: string tableType, // table type enum, e.g. EXTERNAL_TABLE 325 13: optional PrincipalPrivilegeSet privileges, 326 14: optional bool temporary=false, 327 15: optional bool rewriteEnabled, // rewrite enabled or not 328 } 329 330 struct Partition { 331 1: list<string> values // string value is converted to appropriate partition key type 332 2: string dbName, 333 3: string tableName, 334 4: i32 createTime, 335 5: i32 lastAccessTime, 336 6: StorageDescriptor sd, 337 7: map<string, string> parameters, 338 8: optional PrincipalPrivilegeSet privileges 339 } 340 341 struct PartitionWithoutSD { 342 1: list<string> values // string value is converted to appropriate partition key type 343 2: i32 createTime, 344 3: i32 lastAccessTime, 345 4: string relativePath, 346 5: map<string, string> parameters, 347 6: optional PrincipalPrivilegeSet privileges 348 } 349 350 struct PartitionSpecWithSharedSD { 351 1: list<PartitionWithoutSD> partitions, 352 2: StorageDescriptor sd, 353 } 354 355 struct PartitionListComposingSpec { 356 1: list<Partition> partitions 357 } 358 359 struct PartitionSpec { 360 1: string dbName, 361 2: string tableName, 362 3: string rootPath, 363 4: optional PartitionSpecWithSharedSD sharedSDPartitionSpec, 364 5: optional PartitionListComposingSpec partitionList 365 } 366 367 struct Index { 368 1: string indexName, // unique with in the whole database namespace 369 2: string indexHandlerClass, // reserved 370 3: string dbName, 371 4: string origTableName, 372 5: i32 createTime, 373 6: i32 lastAccessTime, 374 7: string indexTableName, 375 8: StorageDescriptor sd, 376 9: map<string, string> parameters, 377 10: bool deferredRebuild 378 } 379 380 // column statistics 381 struct BooleanColumnStatsData { 382 1: required i64 numTrues, 383 2: required i64 numFalses, 384 3: required i64 numNulls, 385 4: optional binary bitVectors 386 } 387 388 struct DoubleColumnStatsData { 389 1: optional double lowValue, 390 2: optional double highValue, 391 3: required i64 numNulls, 392 4: required i64 numDVs, 393 5: optional binary bitVectors 394 } 395 396 struct LongColumnStatsData { 397 1: optional i64 lowValue, 398 2: optional i64 highValue, 399 3: required i64 numNulls, 400 4: required i64 numDVs, 401 5: optional binary bitVectors 402 } 403 404 struct StringColumnStatsData { 405 1: required i64 maxColLen, 406 2: required double avgColLen, 407 3: required i64 numNulls, 408 4: required i64 numDVs, 409 5: optional binary bitVectors 410 } 411 412 struct BinaryColumnStatsData { 413 1: required i64 maxColLen, 414 2: required double avgColLen, 415 3: required i64 numNulls, 416 4: optional binary bitVectors 417 } 418 419 420 struct Decimal { 421 1: required binary unscaled, 422 3: required i16 scale 423 } 424 425 struct DecimalColumnStatsData { 426 1: optional Decimal lowValue, 427 2: optional Decimal highValue, 428 3: required i64 numNulls, 429 4: required i64 numDVs, 430 5: optional binary bitVectors 431 } 432 433 struct Date { 434 1: required i64 daysSinceEpoch 435 } 436 437 struct DateColumnStatsData { 438 1: optional Date lowValue, 439 2: optional Date highValue, 440 3: required i64 numNulls, 441 4: required i64 numDVs, 442 5: optional binary bitVectors 443 } 444 445 union ColumnStatisticsData { 446 1: BooleanColumnStatsData booleanStats, 447 2: LongColumnStatsData longStats, 448 3: DoubleColumnStatsData doubleStats, 449 4: StringColumnStatsData stringStats, 450 5: BinaryColumnStatsData binaryStats, 451 6: DecimalColumnStatsData decimalStats, 452 7: DateColumnStatsData dateStats 453 } 454 455 struct ColumnStatisticsObj { 456 1: required string colName, 457 2: required string colType, 458 3: required ColumnStatisticsData statsData 459 } 460 461 struct ColumnStatisticsDesc { 462 1: required bool isTblLevel, 463 2: required string dbName, 464 3: required string tableName, 465 4: optional string partName, 466 5: optional i64 lastAnalyzed 467 } 468 469 struct ColumnStatistics { 470 1: required ColumnStatisticsDesc statsDesc, 471 2: required list<ColumnStatisticsObj> statsObj; 472 } 473 474 struct AggrStats { 475 1: required list<ColumnStatisticsObj> colStats, 476 2: required i64 partsFound // number of partitions for which stats were found 477 } 478 479 struct SetPartitionsStatsRequest { 480 1: required list<ColumnStatistics> colStats, 481 2: optional bool needMerge //stats need to be merged with the existing stats 482 } 483 484 // schema of the table/query results etc. 485 struct Schema { 486 // column names, types, comments 487 1: list<FieldSchema> fieldSchemas, // delimiters etc 488 2: map<string, string> properties 489 } 490 491 // Key-value store to be used with selected 492 // Metastore APIs (create, alter methods). 493 // The client can pass environment properties / configs that can be 494 // accessed in hooks. 495 struct EnvironmentContext { 496 1: map<string, string> properties 497 } 498 499 struct PrimaryKeysRequest { 500 1: required string db_name, 501 2: required string tbl_name 502 } 503 504 struct PrimaryKeysResponse { 505 1: required list<SQLPrimaryKey> primaryKeys 506 } 507 508 struct ForeignKeysRequest { 509 1: string parent_db_name, 510 2: string parent_tbl_name, 511 3: string foreign_db_name, 512 4: string foreign_tbl_name 513 } 514 515 struct ForeignKeysResponse { 516 1: required list<SQLForeignKey> foreignKeys 517 } 518 519 struct UniqueConstraintsRequest { 520 1: required string db_name, 521 2: required string tbl_name 522 } 523 524 struct UniqueConstraintsResponse { 525 1: required list<SQLUniqueConstraint> uniqueConstraints 526 } 527 528 struct NotNullConstraintsRequest { 529 1: required string db_name, 530 2: required string tbl_name 531 } 532 533 struct NotNullConstraintsResponse { 534 1: required list<SQLNotNullConstraint> notNullConstraints 535 } 536 537 struct DropConstraintRequest { 538 1: required string dbname, 539 2: required string tablename, 540 3: required string constraintname 541 } 542 543 struct AddPrimaryKeyRequest { 544 1: required list<SQLPrimaryKey> primaryKeyCols 545 } 546 547 struct AddForeignKeyRequest { 548 1: required list<SQLForeignKey> foreignKeyCols 549 } 550 551 struct AddUniqueConstraintRequest { 552 1: required list<SQLUniqueConstraint> uniqueConstraintCols 553 } 554 555 struct AddNotNullConstraintRequest { 556 1: required list<SQLNotNullConstraint> notNullConstraintCols 557 } 558 559 // Return type for get_partitions_by_expr 560 struct PartitionsByExprResult { 561 1: required list<Partition> partitions, 562 // Whether the results has any (currently, all) partitions which may or may not match 563 2: required bool hasUnknownPartitions 564 } 565 566 struct PartitionsByExprRequest { 567 1: required string dbName, 568 2: required string tblName, 569 3: required binary expr, 570 4: optional string defaultPartitionName, 571 5: optional i16 maxParts=-1 572 } 573 574 struct TableStatsResult { 575 1: required list<ColumnStatisticsObj> tableStats 576 } 577 578 struct PartitionsStatsResult { 579 1: required map<string, list<ColumnStatisticsObj>> partStats 580 } 581 582 struct TableStatsRequest { 583 1: required string dbName, 584 2: required string tblName, 585 3: required list<string> colNames 586 } 587 588 struct PartitionsStatsRequest { 589 1: required string dbName, 590 2: required string tblName, 591 3: required list<string> colNames, 592 4: required list<string> partNames 593 } 594 595 // Return type for add_partitions_req 596 struct AddPartitionsResult { 597 1: optional list<Partition> partitions, 598 } 599 600 // Request type for add_partitions_req 601 struct AddPartitionsRequest { 602 1: required string dbName, 603 2: required string tblName, 604 3: required list<Partition> parts, 605 4: required bool ifNotExists, 606 5: optional bool needResult=true 607 } 608 609 // Return type for drop_partitions_req 610 struct DropPartitionsResult { 611 1: optional list<Partition> partitions, 612 } 613 614 struct DropPartitionsExpr { 615 1: required binary expr; 616 2: optional i32 partArchiveLevel; 617 } 618 619 union RequestPartsSpec { 620 1: list<string> names; 621 2: list<DropPartitionsExpr> exprs; 622 } 623 624 // Request type for drop_partitions_req 625 // TODO: we might want to add "bestEffort" flag; where a subset can fail 626 struct DropPartitionsRequest { 627 1: required string dbName, 628 2: required string tblName, 629 3: required RequestPartsSpec parts, 630 4: optional bool deleteData, 631 5: optional bool ifExists=true, // currently verified on client 632 6: optional bool ignoreProtection, 633 7: optional EnvironmentContext environmentContext, 634 8: optional bool needResult=true 635 } 636 637 struct PartitionValuesRequest { 638 1: required string dbName, 639 2: required string tblName, 640 3: required list<FieldSchema> partitionKeys; 641 4: optional bool applyDistinct = true; 642 5: optional string filter; 643 6: optional list<FieldSchema> partitionOrder; 644 7: optional bool ascending = true; 645 8: optional i64 maxParts = -1; 646 } 647 648 struct PartitionValuesRow { 649 1: required list<string> row; 650 } 651 652 struct PartitionValuesResponse { 653 1: required list<PartitionValuesRow> partitionValues; 654 } 655 656 enum FunctionType { 657 JAVA = 1, 658 } 659 660 enum ResourceType { 661 JAR = 1, 662 FILE = 2, 663 ARCHIVE = 3, 664 } 665 666 struct ResourceUri { 667 1: ResourceType resourceType, 668 2: string uri, 669 } 670 671 // User-defined function 672 struct Function { 673 1: string functionName, 674 2: string dbName, 675 3: string className, 676 4: string ownerName, 677 5: PrincipalType ownerType, 678 6: i32 createTime, 679 7: FunctionType functionType, 680 8: list<ResourceUri> resourceUris, 681 } 682 683 // Structs for transaction and locks 684 struct TxnInfo { 685 1: required i64 id, 686 2: required TxnState state, 687 3: required string user, // used in 'show transactions' to help admins find who has open transactions 688 4: required string hostname, // used in 'show transactions' to help admins find who has open transactions 689 5: optional string agentInfo = "Unknown", 690 6: optional i32 heartbeatCount=0, 691 7: optional string metaInfo, 692 8: optional i64 startedTime, 693 9: optional i64 lastHeartbeatTime, 694 } 695 696 struct GetOpenTxnsInfoResponse { 697 1: required i64 txn_high_water_mark, 698 2: required list<TxnInfo> open_txns, 699 } 700 701 struct GetOpenTxnsResponse { 702 1: required i64 txn_high_water_mark, 703 2: required list<i64> open_txns, // set<i64> changed to list<i64> since 3.0 704 3: optional i64 min_open_txn, //since 1.3,2.2 705 4: required binary abortedBits, // since 3.0 706 } 707 708 struct OpenTxnRequest { 709 1: required i32 num_txns, 710 2: required string user, 711 3: required string hostname, 712 4: optional string agentInfo = "Unknown", 713 } 714 715 struct OpenTxnsResponse { 716 1: required list<i64> txn_ids, 717 } 718 719 struct AbortTxnRequest { 720 1: required i64 txnid, 721 } 722 723 struct AbortTxnsRequest { 724 1: required list<i64> txn_ids, 725 } 726 727 struct CommitTxnRequest { 728 1: required i64 txnid, 729 } 730 731 struct LockComponent { 732 1: required LockType type, 733 2: required LockLevel level, 734 3: required string dbname, 735 4: optional string tablename, 736 5: optional string partitionname, 737 6: optional DataOperationType operationType = DataOperationType.UNSET, 738 7: optional bool isAcid = false, 739 8: optional bool isDynamicPartitionWrite = false 740 } 741 742 struct LockRequest { 743 1: required list<LockComponent> component, 744 2: optional i64 txnid, 745 3: required string user, // used in 'show locks' to help admins find who has open locks 746 4: required string hostname, // used in 'show locks' to help admins find who has open locks 747 5: optional string agentInfo = "Unknown", 748 } 749 750 struct LockResponse { 751 1: required i64 lockid, 752 2: required LockState state, 753 } 754 755 struct CheckLockRequest { 756 1: required i64 lockid, 757 2: optional i64 txnid, 758 3: optional i64 elapsed_ms, 759 } 760 761 struct UnlockRequest { 762 1: required i64 lockid, 763 } 764 765 struct ShowLocksRequest { 766 1: optional string dbname, 767 2: optional string tablename, 768 3: optional string partname, 769 4: optional bool isExtended=false, 770 } 771 772 struct ShowLocksResponseElement { 773 1: required i64 lockid, 774 2: required string dbname, 775 3: optional string tablename, 776 4: optional string partname, 777 5: required LockState state, 778 6: required LockType type, 779 7: optional i64 txnid, 780 8: required i64 lastheartbeat, 781 9: optional i64 acquiredat, 782 10: required string user, 783 11: required string hostname, 784 12: optional i32 heartbeatCount = 0, 785 13: optional string agentInfo, 786 14: optional i64 blockedByExtId, 787 15: optional i64 blockedByIntId, 788 16: optional i64 lockIdInternal, 789 } 790 791 struct ShowLocksResponse { 792 1: list<ShowLocksResponseElement> locks, 793 } 794 795 struct HeartbeatRequest { 796 1: optional i64 lockid, 797 2: optional i64 txnid 798 } 799 800 struct HeartbeatTxnRangeRequest { 801 1: required i64 min, 802 2: required i64 max 803 } 804 805 struct HeartbeatTxnRangeResponse { 806 1: required set<i64> aborted, 807 2: required set<i64> nosuch 808 } 809 810 struct CompactionRequest { 811 1: required string dbname, 812 2: required string tablename, 813 3: optional string partitionname, 814 4: required CompactionType type, 815 5: optional string runas, 816 6: optional map<string, string> properties 817 } 818 819 struct CompactionResponse { 820 1: required i64 id, 821 2: required string state, 822 3: required bool accepted 823 } 824 825 struct ShowCompactRequest { 826 } 827 828 struct ShowCompactResponseElement { 829 1: required string dbname, 830 2: required string tablename, 831 3: optional string partitionname, 832 4: required CompactionType type, 833 5: required string state, 834 6: optional string workerid, 835 7: optional i64 start, 836 8: optional string runAs, 837 9: optional i64 hightestTxnId, // Highest Txn ID handled by this compaction 838 10: optional string metaInfo, 839 11: optional i64 endTime, 840 12: optional string hadoopJobId = "None", 841 13: optional i64 id, 842 } 843 844 struct ShowCompactResponse { 845 1: required list<ShowCompactResponseElement> compacts, 846 } 847 848 struct AddDynamicPartitions { 849 1: required i64 txnid, 850 2: required string dbname, 851 3: required string tablename, 852 4: required list<string> partitionnames, 853 5: optional DataOperationType operationType = DataOperationType.UNSET 854 } 855 856 struct NotificationEventRequest { 857 1: required i64 lastEvent, 858 2: optional i32 maxEvents, 859 } 860 861 struct NotificationEvent { 862 1: required i64 eventId, 863 2: required i32 eventTime, 864 3: required string eventType, 865 4: optional string dbName, 866 5: optional string tableName, 867 6: required string message, 868 7: optional string messageFormat, 869 } 870 871 struct NotificationEventResponse { 872 1: required list<NotificationEvent> events, 873 } 874 875 struct CurrentNotificationEventId { 876 1: required i64 eventId, 877 } 878 879 struct NotificationEventsCountRequest { 880 1: required i64 fromEventId, 881 2: required string dbName, 882 } 883 884 struct NotificationEventsCountResponse { 885 1: required i64 eventsCount, 886 } 887 888 struct InsertEventRequestData { 889 1: optional bool replace, 890 2: required list<string> filesAdded, 891 // Checksum of files (hex string of checksum byte payload) 892 3: optional list<string> filesAddedChecksum, 893 } 894 895 union FireEventRequestData { 896 1: InsertEventRequestData insertData 897 } 898 899 struct FireEventRequest { 900 1: required bool successful, 901 2: required FireEventRequestData data 902 // dbname, tablename, and partition vals are included as optional in the top level event rather than placed in each type of 903 // subevent as I assume they'll be used across most event types. 904 3: optional string dbName, 905 4: optional string tableName, 906 5: optional list<string> partitionVals, 907 } 908 909 struct FireEventResponse { 910 // NOP for now, this is just a place holder for future responses 911 } 912 913 struct MetadataPpdResult { 914 1: optional binary metadata, 915 2: optional binary includeBitset 916 } 917 918 // Return type for get_file_metadata_by_expr 919 struct GetFileMetadataByExprResult { 920 1: required map<i64, MetadataPpdResult> metadata, 921 2: required bool isSupported 922 } 923 924 enum FileMetadataExprType { 925 ORC_SARG = 1 926 } 927 928 929 // Request type for get_file_metadata_by_expr 930 struct GetFileMetadataByExprRequest { 931 1: required list<i64> fileIds, 932 2: required binary expr, 933 3: optional bool doGetFooters, 934 4: optional FileMetadataExprType type 935 } 936 937 // Return type for get_file_metadata 938 struct GetFileMetadataResult { 939 1: required map<i64, binary> metadata, 940 2: required bool isSupported 941 } 942 943 // Request type for get_file_metadata 944 struct GetFileMetadataRequest { 945 1: required list<i64> fileIds 946 } 947 948 // Return type for put_file_metadata 949 struct PutFileMetadataResult { 950 } 951 952 // Request type for put_file_metadata 953 struct PutFileMetadataRequest { 954 1: required list<i64> fileIds, 955 2: required list<binary> metadata, 956 3: optional FileMetadataExprType type 957 } 958 959 // Return type for clear_file_metadata 960 struct ClearFileMetadataResult { 961 } 962 963 // Request type for clear_file_metadata 964 struct ClearFileMetadataRequest { 965 1: required list<i64> fileIds 966 } 967 968 // Return type for cache_file_metadata 969 struct CacheFileMetadataResult { 970 1: required bool isSupported 971 } 972 973 // Request type for cache_file_metadata 974 struct CacheFileMetadataRequest { 975 1: required string dbName, 976 2: required string tblName, 977 3: optional string partName, 978 4: optional bool isAllParts 979 } 980 981 struct GetAllFunctionsResponse { 982 1: optional list<Function> functions 983 } 984 985 enum ClientCapability { 986 TEST_CAPABILITY = 1, 987 INSERT_ONLY_TABLES = 2 988 } 989 990 991 struct ClientCapabilities { 992 1: required list<ClientCapability> values 993 } 994 995 struct GetTableRequest { 996 1: required string dbName, 997 2: required string tblName, 998 3: optional ClientCapabilities capabilities 999 } 1000 1001 struct GetTableResult { 1002 1: required Table table 1003 } 1004 1005 struct GetTablesRequest { 1006 1: required string dbName, 1007 2: optional list<string> tblNames, 1008 3: optional ClientCapabilities capabilities 1009 } 1010 1011 struct GetTablesResult { 1012 1: required list<Table> tables 1013 } 1014 1015 // Request type for cm_recycle 1016 struct CmRecycleRequest { 1017 1: required string dataPath, 1018 2: required bool purge 1019 } 1020 1021 // Response type for cm_recycle 1022 struct CmRecycleResponse { 1023 } 1024 1025 struct TableMeta { 1026 1: required string dbName; 1027 2: required string tableName; 1028 3: required string tableType; 1029 4: optional string comments; 1030 } 1031 1032 // Data types for workload management. 1033 1034 enum WMResourcePlanStatus { 1035 ACTIVE = 1, 1036 ENABLED = 2, 1037 DISABLED = 3 1038 } 1039 1040 struct WMResourcePlan { 1041 1: required string name; 1042 2: optional WMResourcePlanStatus status; 1043 3: optional i32 queryParallelism; 1044 4: optional string defaultPoolPath; 1045 } 1046 1047 struct WMPool { 1048 1: required string resourcePlanName; 1049 2: required string poolPath; 1050 3: optional double allocFraction; 1051 4: optional i32 queryParallelism; 1052 5: optional string schedulingPolicy; 1053 } 1054 1055 struct WMTrigger { 1056 1: required string resourcePlanName; 1057 2: required string triggerName; 1058 3: optional string triggerExpression; 1059 4: optional string actionExpression; 1060 } 1061 1062 struct WMMapping { 1063 1: required string resourcePlanName; 1064 2: required string entityType; 1065 3: required string entityName; 1066 4: optional string poolName; 1067 5: optional i32 ordering; 1068 } 1069 1070 struct WMPoolTrigger { 1071 1: required string pool; 1072 2: required string trigger; 1073 } 1074 1075 struct WMFullResourcePlan { 1076 1: required WMResourcePlan plan; 1077 2: required list<WMPool> pools; 1078 3: optional list<WMMapping> mappings; 1079 4: optional list<WMTrigger> triggers; 1080 5: optional list<WMPoolTrigger> poolTriggers; 1081 } 1082 1083 // Request response for workload management API's. 1084 1085 struct WMCreateResourcePlanRequest { 1086 1: optional WMResourcePlan resourcePlan; 1087 } 1088 1089 struct WMCreateResourcePlanResponse { 1090 } 1091 1092 struct WMGetActiveResourcePlanRequest { 1093 } 1094 1095 struct WMGetActiveResourcePlanResponse { 1096 1: optional WMFullResourcePlan resourcePlan; 1097 } 1098 1099 struct WMGetResourcePlanRequest { 1100 1: optional string resourcePlanName; 1101 } 1102 1103 struct WMGetResourcePlanResponse { 1104 1: optional WMResourcePlan resourcePlan; 1105 } 1106 1107 struct WMGetAllResourcePlanRequest { 1108 } 1109 1110 struct WMGetAllResourcePlanResponse { 1111 1: optional list<WMResourcePlan> resourcePlans; 1112 } 1113 1114 struct WMAlterResourcePlanRequest { 1115 1: optional string resourcePlanName; 1116 2: optional WMResourcePlan resourcePlan; 1117 3: optional bool isEnableAndActivate; 1118 } 1119 1120 struct WMAlterResourcePlanResponse { 1121 1: optional WMFullResourcePlan fullResourcePlan; 1122 } 1123 1124 struct WMValidateResourcePlanRequest { 1125 1: optional string resourcePlanName; 1126 } 1127 1128 struct WMValidateResourcePlanResponse { 1129 1: optional bool isValid; 1130 } 1131 1132 struct WMDropResourcePlanRequest { 1133 1: optional string resourcePlanName; 1134 } 1135 1136 struct WMDropResourcePlanResponse { 1137 } 1138 1139 struct WMCreateTriggerRequest { 1140 1: optional WMTrigger trigger; 1141 } 1142 1143 struct WMCreateTriggerResponse { 1144 } 1145 1146 struct WMAlterTriggerRequest { 1147 1: optional WMTrigger trigger; 1148 } 1149 1150 struct WMAlterTriggerResponse { 1151 } 1152 1153 struct WMDropTriggerRequest { 1154 1: optional string resourcePlanName; 1155 2: optional string triggerName; 1156 } 1157 1158 struct WMDropTriggerResponse { 1159 } 1160 1161 struct WMGetTriggersForResourePlanRequest { 1162 1: optional string resourcePlanName; 1163 } 1164 1165 struct WMGetTriggersForResourePlanResponse { 1166 1: optional list<WMTrigger> triggers; 1167 } 1168 1169 1170 // Exceptions. 1171 1172 exception MetaException { 1173 1: string message 1174 } 1175 1176 exception UnknownTableException { 1177 1: string message 1178 } 1179 1180 exception UnknownDBException { 1181 1: string message 1182 } 1183 1184 exception AlreadyExistsException { 1185 1: string message 1186 } 1187 1188 exception InvalidPartitionException { 1189 1: string message 1190 } 1191 1192 exception UnknownPartitionException { 1193 1: string message 1194 } 1195 1196 exception InvalidObjectException { 1197 1: string message 1198 } 1199 1200 exception NoSuchObjectException { 1201 1: string message 1202 } 1203 1204 exception IndexAlreadyExistsException { 1205 1: string message 1206 } 1207 1208 exception InvalidOperationException { 1209 1: string message 1210 } 1211 1212 exception ConfigValSecurityException { 1213 1: string message 1214 } 1215 1216 exception InvalidInputException { 1217 1: string message 1218 } 1219 1220 // Transaction and lock exceptions 1221 exception NoSuchTxnException { 1222 1: string message 1223 } 1224 1225 exception TxnAbortedException { 1226 1: string message 1227 } 1228 1229 exception TxnOpenException { 1230 1: string message 1231 } 1232 1233 exception NoSuchLockException { 1234 1: string message 1235 } 1236 1237 /** 1238 * This interface is live. 1239 */ 1240 service ThriftHiveMetastore 1241 { 1242 string getMetaConf(1:string key) throws(1:MetaException o1) 1243 void setMetaConf(1:string key, 2:string value) throws(1:MetaException o1) 1244 1245 void create_database(1:Database database) throws(1:AlreadyExistsException o1, 2:InvalidObjectException o2, 3:MetaException o3) 1246 Database get_database(1:string name) throws(1:NoSuchObjectException o1, 2:MetaException o2) 1247 void drop_database(1:string name, 2:bool deleteData, 3:bool cascade) throws(1:NoSuchObjectException o1, 2:InvalidOperationException o2, 3:MetaException o3) 1248 list<string> get_databases(1:string pattern) throws(1:MetaException o1) 1249 list<string> get_all_databases() throws(1:MetaException o1) 1250 void alter_database(1:string dbname, 2:Database db) throws(1:MetaException o1, 2:NoSuchObjectException o2) 1251 1252 // returns the type with given name (make seperate calls for the dependent types if needed) 1253 Type get_type(1:string name) throws(1:MetaException o1, 2:NoSuchObjectException o2) 1254 bool create_type(1:Type type) throws(1:AlreadyExistsException o1, 2:InvalidObjectException o2, 3:MetaException o3) 1255 bool drop_type(1:string type) throws(1:MetaException o1, 2:NoSuchObjectException o2) 1256 map<string, Type> get_type_all(1:string name) 1257 throws(1:MetaException o2) 1258 1259 // Gets a list of FieldSchemas describing the columns of a particular table 1260 list<FieldSchema> get_fields(1: string db_name, 2: string table_name) throws (1: MetaException o1, 2: UnknownTableException o2, 3: UnknownDBException o3), 1261 list<FieldSchema> get_fields_with_environment_context(1: string db_name, 2: string table_name, 3:EnvironmentContext environment_context) throws (1: MetaException o1, 2: UnknownTableException o2, 3: UnknownDBException o3) 1262 1263 // Gets a list of FieldSchemas describing both the columns and the partition keys of a particular table 1264 list<FieldSchema> get_schema(1: string db_name, 2: string table_name) throws (1: MetaException o1, 2: UnknownTableException o2, 3: UnknownDBException o3) 1265 list<FieldSchema> get_schema_with_environment_context(1: string db_name, 2: string table_name, 3:EnvironmentContext environment_context) throws (1: MetaException o1, 2: UnknownTableException o2, 3: UnknownDBException o3) 1266 1267 // create a Hive table. Following fields must be set 1268 // tableName 1269 // database (only 'default' for now until Hive QL supports databases) 1270 // owner (not needed, but good to have for tracking purposes) 1271 // sd.cols (list of field schemas) 1272 // sd.inputFormat (SequenceFileInputFormat (binary like falcon tables or u_full) or TextInputFormat) 1273 // sd.outputFormat (SequenceFileInputFormat (binary) or TextInputFormat) 1274 // sd.serdeInfo.serializationLib (SerDe class name eg org.apache.hadoop.hive.serde.simple_meta.MetadataTypedColumnsetSerDe 1275 // * See notes on DDL_TIME 1276 void create_table(1:Table tbl) throws(1:AlreadyExistsException o1, 2:InvalidObjectException o2, 3:MetaException o3, 4:NoSuchObjectException o4) 1277 void create_table_with_environment_context(1:Table tbl, 1278 2:EnvironmentContext environment_context) 1279 throws (1:AlreadyExistsException o1, 1280 2:InvalidObjectException o2, 3:MetaException o3, 1281 4:NoSuchObjectException o4) 1282 void create_table_with_constraints(1:Table tbl, 2: list<SQLPrimaryKey> primaryKeys, 3: list<SQLForeignKey> foreignKeys, 1283 4: list<SQLUniqueConstraint> uniqueConstraints, 5: list<SQLNotNullConstraint> notNullConstraints) 1284 throws (1:AlreadyExistsException o1, 1285 2:InvalidObjectException o2, 3:MetaException o3, 1286 4:NoSuchObjectException o4) 1287 void drop_constraint(1:DropConstraintRequest req) 1288 throws(1:NoSuchObjectException o1, 2:MetaException o3) 1289 void add_primary_key(1:AddPrimaryKeyRequest req) 1290 throws(1:NoSuchObjectException o1, 2:MetaException o2) 1291 void add_foreign_key(1:AddForeignKeyRequest req) 1292 throws(1:NoSuchObjectException o1, 2:MetaException o2) 1293 void add_unique_constraint(1:AddUniqueConstraintRequest req) 1294 throws(1:NoSuchObjectException o1, 2:MetaException o2) 1295 void add_not_null_constraint(1:AddNotNullConstraintRequest req) 1296 throws(1:NoSuchObjectException o1, 2:MetaException o2) 1297 1298 // drops the table and all the partitions associated with it if the table has partitions 1299 // delete data (including partitions) if deleteData is set to true 1300 void drop_table(1:string dbname, 2:string name, 3:bool deleteData) 1301 throws(1:NoSuchObjectException o1, 2:MetaException o3) 1302 void drop_table_with_environment_context(1:string dbname, 2:string name, 3:bool deleteData, 1303 4:EnvironmentContext environment_context) 1304 throws(1:NoSuchObjectException o1, 2:MetaException o3) 1305 void truncate_table(1:string dbName, 2:string tableName, 3:list<string> partNames) 1306 throws(1:MetaException o1) 1307 list<string> get_tables(1: string db_name, 2: string pattern) throws (1: MetaException o1) 1308 list<string> get_tables_by_type(1: string db_name, 2: string pattern, 3: string tableType) throws (1: MetaException o1) 1309 list<TableMeta> get_table_meta(1: string db_patterns, 2: string tbl_patterns, 3: list<string> tbl_types) 1310 throws (1: MetaException o1) 1311 list<string> get_all_tables(1: string db_name) throws (1: MetaException o1) 1312 1313 Table get_table(1:string dbname, 2:string tbl_name) 1314 throws (1:MetaException o1, 2:NoSuchObjectException o2) 1315 list<Table> get_table_objects_by_name(1:string dbname, 2:list<string> tbl_names) 1316 GetTableResult get_table_req(1:GetTableRequest req) throws (1:MetaException o1, 2:NoSuchObjectException o2) 1317 GetTablesResult get_table_objects_by_name_req(1:GetTablesRequest req) 1318 throws (1:MetaException o1, 2:InvalidOperationException o2, 3:UnknownDBException o3) 1319 1320 // Get a list of table names that match a filter. 1321 // The filter operators are LIKE, <, <=, >, >=, =, <> 1322 // 1323 // In the filter statement, values interpreted as strings must be enclosed in quotes, 1324 // while values interpreted as integers should not be. Strings and integers are the only 1325 // supported value types. 1326 // 1327 // The currently supported key names in the filter are: 1328 // Constants.HIVE_FILTER_FIELD_OWNER, which filters on the tables' owner's name 1329 // and supports all filter operators 1330 // Constants.HIVE_FILTER_FIELD_LAST_ACCESS, which filters on the last access times 1331 // and supports all filter operators except LIKE 1332 // Constants.HIVE_FILTER_FIELD_PARAMS, which filters on the tables' parameter keys and values 1333 // and only supports the filter operators = and <>. 1334 // Append the parameter key name to HIVE_FILTER_FIELD_PARAMS in the filter statement. 1335 // For example, to filter on parameter keys called "retention", the key name in the filter 1336 // statement should be Constants.HIVE_FILTER_FIELD_PARAMS + "retention" 1337 // Also, = and <> only work for keys that exist 1338 // in the tables. E.g., if you are looking for tables where key1 <> value, it will only 1339 // look at tables that have a value for the parameter key1. 1340 // Some example filter statements include: 1341 // filter = Constants.HIVE_FILTER_FIELD_OWNER + " like \".*test.*\" and " + 1342 // Constants.HIVE_FILTER_FIELD_LAST_ACCESS + " = 0"; 1343 // filter = Constants.HIVE_FILTER_FIELD_PARAMS + "retention = \"30\" or " + 1344 // Constants.HIVE_FILTER_FIELD_PARAMS + "retention = \"90\"" 1345 // @param dbName 1346 // The name of the database from which you will retrieve the table names 1347 // @param filterType 1348 // The type of filter 1349 // @param filter 1350 // The filter string 1351 // @param max_tables 1352 // The maximum number of tables returned 1353 // @return A list of table names that match the desired filter 1354 list<string> get_table_names_by_filter(1:string dbname, 2:string filter, 3:i16 max_tables=-1) 1355 throws (1:MetaException o1, 2:InvalidOperationException o2, 3:UnknownDBException o3) 1356 1357 // alter table applies to only future partitions not for existing partitions 1358 // * See notes on DDL_TIME 1359 void alter_table(1:string dbname, 2:string tbl_name, 3:Table new_tbl) 1360 throws (1:InvalidOperationException o1, 2:MetaException o2) 1361 void alter_table_with_environment_context(1:string dbname, 2:string tbl_name, 1362 3:Table new_tbl, 4:EnvironmentContext environment_context) 1363 throws (1:InvalidOperationException o1, 2:MetaException o2) 1364 // alter table not only applies to future partitions but also cascade to existing partitions 1365 void alter_table_with_cascade(1:string dbname, 2:string tbl_name, 3:Table new_tbl, 4:bool cascade) 1366 throws (1:InvalidOperationException o1, 2:MetaException o2) 1367 // the following applies to only tables that have partitions 1368 // * See notes on DDL_TIME 1369 Partition add_partition(1:Partition new_part) 1370 throws(1:InvalidObjectException o1, 2:AlreadyExistsException o2, 3:MetaException o3) 1371 Partition add_partition_with_environment_context(1:Partition new_part, 1372 2:EnvironmentContext environment_context) 1373 throws (1:InvalidObjectException o1, 2:AlreadyExistsException o2, 1374 3:MetaException o3) 1375 i32 add_partitions(1:list<Partition> new_parts) 1376 throws(1:InvalidObjectException o1, 2:AlreadyExistsException o2, 3:MetaException o3) 1377 i32 add_partitions_pspec(1:list<PartitionSpec> new_parts) 1378 throws(1:InvalidObjectException o1, 2:AlreadyExistsException o2, 3:MetaException o3) 1379 Partition append_partition(1:string db_name, 2:string tbl_name, 3:list<string> part_vals) 1380 throws (1:InvalidObjectException o1, 2:AlreadyExistsException o2, 3:MetaException o3) 1381 AddPartitionsResult add_partitions_req(1:AddPartitionsRequest request) 1382 throws(1:InvalidObjectException o1, 2:AlreadyExistsException o2, 3:MetaException o3) 1383 Partition append_partition_with_environment_context(1:string db_name, 2:string tbl_name, 1384 3:list<string> part_vals, 4:EnvironmentContext environment_context) 1385 throws (1:InvalidObjectException o1, 2:AlreadyExistsException o2, 3:MetaException o3) 1386 Partition append_partition_by_name(1:string db_name, 2:string tbl_name, 3:string part_name) 1387 throws (1:InvalidObjectException o1, 2:AlreadyExistsException o2, 3:MetaException o3) 1388 Partition append_partition_by_name_with_environment_context(1:string db_name, 2:string tbl_name, 1389 3:string part_name, 4:EnvironmentContext environment_context) 1390 throws (1:InvalidObjectException o1, 2:AlreadyExistsException o2, 3:MetaException o3) 1391 bool drop_partition(1:string db_name, 2:string tbl_name, 3:list<string> part_vals, 4:bool deleteData) 1392 throws(1:NoSuchObjectException o1, 2:MetaException o2) 1393 bool drop_partition_with_environment_context(1:string db_name, 2:string tbl_name, 1394 3:list<string> part_vals, 4:bool deleteData, 5:EnvironmentContext environment_context) 1395 throws(1:NoSuchObjectException o1, 2:MetaException o2) 1396 bool drop_partition_by_name(1:string db_name, 2:string tbl_name, 3:string part_name, 4:bool deleteData) 1397 throws(1:NoSuchObjectException o1, 2:MetaException o2) 1398 bool drop_partition_by_name_with_environment_context(1:string db_name, 2:string tbl_name, 1399 3:string part_name, 4:bool deleteData, 5:EnvironmentContext environment_context) 1400 throws(1:NoSuchObjectException o1, 2:MetaException o2) 1401 DropPartitionsResult drop_partitions_req(1: DropPartitionsRequest req) 1402 throws(1:NoSuchObjectException o1, 2:MetaException o2) 1403 1404 Partition get_partition(1:string db_name, 2:string tbl_name, 3:list<string> part_vals) 1405 throws(1:MetaException o1, 2:NoSuchObjectException o2) 1406 Partition exchange_partition(1:map<string, string> partitionSpecs, 2:string source_db, 1407 3:string source_table_name, 4:string dest_db, 5:string dest_table_name) 1408 throws(1:MetaException o1, 2:NoSuchObjectException o2, 3:InvalidObjectException o3, 1409 4:InvalidInputException o4) 1410 1411 list<Partition> exchange_partitions(1:map<string, string> partitionSpecs, 2:string source_db, 1412 3:string source_table_name, 4:string dest_db, 5:string dest_table_name) 1413 throws(1:MetaException o1, 2:NoSuchObjectException o2, 3:InvalidObjectException o3, 1414 4:InvalidInputException o4) 1415 1416 Partition get_partition_with_auth(1:string db_name, 2:string tbl_name, 3:list<string> part_vals, 1417 4: string user_name, 5: list<string> group_names) throws(1:MetaException o1, 2:NoSuchObjectException o2) 1418 1419 Partition get_partition_by_name(1:string db_name 2:string tbl_name, 3:string part_name) 1420 throws(1:MetaException o1, 2:NoSuchObjectException o2) 1421 1422 // returns all the partitions for this table in reverse chronological order. 1423 // If max parts is given then it will return only that many. 1424 list<Partition> get_partitions(1:string db_name, 2:string tbl_name, 3:i16 max_parts=-1) 1425 throws(1:NoSuchObjectException o1, 2:MetaException o2) 1426 list<Partition> get_partitions_with_auth(1:string db_name, 2:string tbl_name, 3:i16 max_parts=-1, 1427 4: string user_name, 5: list<string> group_names) throws(1:NoSuchObjectException o1, 2:MetaException o2) 1428 1429 list<PartitionSpec> get_partitions_pspec(1:string db_name, 2:string tbl_name, 3:i32 max_parts=-1) 1430 throws(1:NoSuchObjectException o1, 2:MetaException o2) 1431 1432 list<string> get_partition_names(1:string db_name, 2:string tbl_name, 3:i16 max_parts=-1) 1433 throws(1:NoSuchObjectException o1, 2:MetaException o2) 1434 1435 PartitionValuesResponse get_partition_values(1:PartitionValuesRequest request) 1436 throws(1:MetaException o1, 2:NoSuchObjectException o2); 1437 1438 // get_partition*_ps methods allow filtering by a partial partition specification, 1439 // as needed for dynamic partitions. The values that are not restricted should 1440 // be empty strings. Nulls were considered (instead of "") but caused errors in 1441 // generated Python code. The size of part_vals may be smaller than the 1442 // number of partition columns - the unspecified values are considered the same 1443 // as "". 1444 list<Partition> get_partitions_ps(1:string db_name 2:string tbl_name 1445 3:list<string> part_vals, 4:i16 max_parts=-1) 1446 throws(1:MetaException o1, 2:NoSuchObjectException o2) 1447 list<Partition> get_partitions_ps_with_auth(1:string db_name, 2:string tbl_name, 3:list<string> part_vals, 4:i16 max_parts=-1, 1448 5: string user_name, 6: list<string> group_names) throws(1:NoSuchObjectException o1, 2:MetaException o2) 1449 1450 list<string> get_partition_names_ps(1:string db_name, 1451 2:string tbl_name, 3:list<string> part_vals, 4:i16 max_parts=-1) 1452 throws(1:MetaException o1, 2:NoSuchObjectException o2) 1453 1454 // get the partitions matching the given partition filter 1455 list<Partition> get_partitions_by_filter(1:string db_name 2:string tbl_name 1456 3:string filter, 4:i16 max_parts=-1) 1457 throws(1:MetaException o1, 2:NoSuchObjectException o2) 1458 1459 // List partitions as PartitionSpec instances. 1460 list<PartitionSpec> get_part_specs_by_filter(1:string db_name 2:string tbl_name 1461 3:string filter, 4:i32 max_parts=-1) 1462 throws(1:MetaException o1, 2:NoSuchObjectException o2) 1463 1464 // get the partitions matching the given partition filter 1465 // unlike get_partitions_by_filter, takes serialized hive expression, and with that can work 1466 // with any filter (get_partitions_by_filter only works if the filter can be pushed down to JDOQL. 1467 PartitionsByExprResult get_partitions_by_expr(1:PartitionsByExprRequest req) 1468 throws(1:MetaException o1, 2:NoSuchObjectException o2) 1469 1470 // get the partitions matching the given partition filter 1471 i32 get_num_partitions_by_filter(1:string db_name 2:string tbl_name 3:string filter) 1472 throws(1:MetaException o1, 2:NoSuchObjectException o2) 1473 1474 // get partitions give a list of partition names 1475 list<Partition> get_partitions_by_names(1:string db_name 2:string tbl_name 3:list<string> names) 1476 throws(1:MetaException o1, 2:NoSuchObjectException o2) 1477 1478 // changes the partition to the new partition object. partition is identified from the part values 1479 // in the new_part 1480 // * See notes on DDL_TIME 1481 void alter_partition(1:string db_name, 2:string tbl_name, 3:Partition new_part) 1482 throws (1:InvalidOperationException o1, 2:MetaException o2) 1483 1484 // change a list of partitions. All partitions are altered atomically and all 1485 // prehooks are fired together followed by all post hooks 1486 void alter_partitions(1:string db_name, 2:string tbl_name, 3:list<Partition> new_parts) 1487 throws (1:InvalidOperationException o1, 2:MetaException o2) 1488 void alter_partitions_with_environment_context(1:string db_name, 2:string tbl_name, 3:list<Partition> new_parts, 4:EnvironmentContext environment_context) throws (1:InvalidOperationException o1, 2:MetaException o2) 1489 1490 void alter_partition_with_environment_context(1:string db_name, 1491 2:string tbl_name, 3:Partition new_part, 1492 4:EnvironmentContext environment_context) 1493 throws (1:InvalidOperationException o1, 2:MetaException o2) 1494 1495 // rename the old partition to the new partition object by changing old part values to the part values 1496 // in the new_part. old partition is identified from part_vals. 1497 // partition keys in new_part should be the same as those in old partition. 1498 void rename_partition(1:string db_name, 2:string tbl_name, 3:list<string> part_vals, 4:Partition new_part) 1499 throws (1:InvalidOperationException o1, 2:MetaException o2) 1500 1501 // returns whether or not the partition name is valid based on the value of the config 1502 // hive.metastore.partition.name.whitelist.pattern 1503 bool partition_name_has_valid_characters(1:list<string> part_vals, 2:bool throw_exception) 1504 throws(1: MetaException o1) 1505 1506 // gets the value of the configuration key in the metastore server. returns 1507 // defaultValue if the key does not exist. if the configuration key does not 1508 // begin with "hive", "mapred", or "hdfs", a ConfigValSecurityException is 1509 // thrown. 1510 string get_config_value(1:string name, 2:string defaultValue) 1511 throws(1:ConfigValSecurityException o1) 1512 1513 // converts a partition name into a partition values array 1514 list<string> partition_name_to_vals(1: string part_name) 1515 throws(1: MetaException o1) 1516 // converts a partition name into a partition specification (a mapping from 1517 // the partition cols to the values) 1518 map<string, string> partition_name_to_spec(1: string part_name) 1519 throws(1: MetaException o1) 1520 1521 void markPartitionForEvent(1:string db_name, 2:string tbl_name, 3:map<string,string> part_vals, 1522 4:PartitionEventType eventType) throws (1: MetaException o1, 2: NoSuchObjectException o2, 1523 3: UnknownDBException o3, 4: UnknownTableException o4, 5: UnknownPartitionException o5, 1524 6: InvalidPartitionException o6) 1525 bool isPartitionMarkedForEvent(1:string db_name, 2:string tbl_name, 3:map<string,string> part_vals, 1526 4: PartitionEventType eventType) throws (1: MetaException o1, 2:NoSuchObjectException o2, 1527 3: UnknownDBException o3, 4: UnknownTableException o4, 5: UnknownPartitionException o5, 1528 6: InvalidPartitionException o6) 1529 1530 //index 1531 Index add_index(1:Index new_index, 2: Table index_table) 1532 throws(1:InvalidObjectException o1, 2:AlreadyExistsException o2, 3:MetaException o3) 1533 void alter_index(1:string dbname, 2:string base_tbl_name, 3:string idx_name, 4:Index new_idx) 1534 throws (1:InvalidOperationException o1, 2:MetaException o2) 1535 bool drop_index_by_name(1:string db_name, 2:string tbl_name, 3:string index_name, 4:bool deleteData) 1536 throws(1:NoSuchObjectException o1, 2:MetaException o2) 1537 Index get_index_by_name(1:string db_name 2:string tbl_name, 3:string index_name) 1538 throws(1:MetaException o1, 2:NoSuchObjectException o2) 1539 1540 list<Index> get_indexes(1:string db_name, 2:string tbl_name, 3:i16 max_indexes=-1) 1541 throws(1:NoSuchObjectException o1, 2:MetaException o2) 1542 list<string> get_index_names(1:string db_name, 2:string tbl_name, 3:i16 max_indexes=-1) 1543 throws(1:MetaException o2) 1544 1545 //primary keys and foreign keys 1546 PrimaryKeysResponse get_primary_keys(1:PrimaryKeysRequest request) 1547 throws(1:MetaException o1, 2:NoSuchObjectException o2) 1548 ForeignKeysResponse get_foreign_keys(1:ForeignKeysRequest request) 1549 throws(1:MetaException o1, 2:NoSuchObjectException o2) 1550 // other constraints 1551 UniqueConstraintsResponse get_unique_constraints(1:UniqueConstraintsRequest request) 1552 throws(1:MetaException o1, 2:NoSuchObjectException o2) 1553 NotNullConstraintsResponse get_not_null_constraints(1:NotNullConstraintsRequest request) 1554 throws(1:MetaException o1, 2:NoSuchObjectException o2) 1555 1556 // column statistics interfaces 1557 1558 // update APIs persist the column statistics object(s) that are passed in. If statistics already 1559 // exists for one or more columns, the existing statistics will be overwritten. The update APIs 1560 // validate that the dbName, tableName, partName, colName[] passed in as part of the ColumnStatistics 1561 // struct are valid, throws InvalidInputException/NoSuchObjectException if found to be invalid 1562 bool update_table_column_statistics(1:ColumnStatistics stats_obj) throws (1:NoSuchObjectException o1, 1563 2:InvalidObjectException o2, 3:MetaException o3, 4:InvalidInputException o4) 1564 bool update_partition_column_statistics(1:ColumnStatistics stats_obj) throws (1:NoSuchObjectException o1, 1565 2:InvalidObjectException o2, 3:MetaException o3, 4:InvalidInputException o4) 1566 1567 // get APIs return the column statistics corresponding to db_name, tbl_name, [part_name], col_name if 1568 // such statistics exists. If the required statistics doesn't exist, get APIs throw NoSuchObjectException 1569 // For instance, if get_table_column_statistics is called on a partitioned table for which only 1570 // partition level column stats exist, get_table_column_statistics will throw NoSuchObjectException 1571 ColumnStatistics get_table_column_statistics(1:string db_name, 2:string tbl_name, 3:string col_name) throws 1572 (1:NoSuchObjectException o1, 2:MetaException o2, 3:InvalidInputException o3, 4:InvalidObjectException o4) 1573 ColumnStatistics get_partition_column_statistics(1:string db_name, 2:string tbl_name, 3:string part_name, 1574 4:string col_name) throws (1:NoSuchObjectException o1, 2:MetaException o2, 1575 3:InvalidInputException o3, 4:InvalidObjectException o4) 1576 TableStatsResult get_table_statistics_req(1:TableStatsRequest request) throws 1577 (1:NoSuchObjectException o1, 2:MetaException o2) 1578 PartitionsStatsResult get_partitions_statistics_req(1:PartitionsStatsRequest request) throws 1579 (1:NoSuchObjectException o1, 2:MetaException o2) 1580 AggrStats get_aggr_stats_for(1:PartitionsStatsRequest request) throws 1581 (1:NoSuchObjectException o1, 2:MetaException o2) 1582 bool set_aggr_stats_for(1:SetPartitionsStatsRequest request) throws 1583 (1:NoSuchObjectException o1, 2:InvalidObjectException o2, 3:MetaException o3, 4:InvalidInputException o4) 1584 1585 1586 // delete APIs attempt to delete column statistics, if found, associated with a given db_name, tbl_name, [part_name] 1587 // and col_name. If the delete API doesn't find the statistics record in the metastore, throws NoSuchObjectException 1588 // Delete API validates the input and if the input is invalid throws InvalidInputException/InvalidObjectException. 1589 bool delete_partition_column_statistics(1:string db_name, 2:string tbl_name, 3:string part_name, 4:string col_name) throws 1590 (1:NoSuchObjectException o1, 2:MetaException o2, 3:InvalidObjectException o3, 1591 4:InvalidInputException o4) 1592 bool delete_table_column_statistics(1:string db_name, 2:string tbl_name, 3:string col_name) throws 1593 (1:NoSuchObjectException o1, 2:MetaException o2, 3:InvalidObjectException o3, 1594 4:InvalidInputException o4) 1595 1596 // 1597 // user-defined functions 1598 // 1599 1600 void create_function(1:Function func) 1601 throws (1:AlreadyExistsException o1, 1602 2:InvalidObjectException o2, 1603 3:MetaException o3, 1604 4:NoSuchObjectException o4) 1605 1606 void drop_function(1:string dbName, 2:string funcName) 1607 throws (1:NoSuchObjectException o1, 2:MetaException o3) 1608 1609 void alter_function(1:string dbName, 2:string funcName, 3:Function newFunc) 1610 throws (1:InvalidOperationException o1, 2:MetaException o2) 1611 1612 list<string> get_functions(1:string dbName, 2:string pattern) 1613 throws (1:MetaException o1) 1614 Function get_function(1:string dbName, 2:string funcName) 1615 throws (1:MetaException o1, 2:NoSuchObjectException o2) 1616 1617 GetAllFunctionsResponse get_all_functions() throws (1:MetaException o1) 1618 1619 //authorization privileges 1620 1621 bool create_role(1:Role role) throws(1:MetaException o1) 1622 bool drop_role(1:string role_name) throws(1:MetaException o1) 1623 list<string> get_role_names() throws(1:MetaException o1) 1624 // Deprecated, use grant_revoke_role() 1625 bool grant_role(1:string role_name, 2:string principal_name, 3:PrincipalType principal_type, 1626 4:string grantor, 5:PrincipalType grantorType, 6:bool grant_option) throws(1:MetaException o1) 1627 // Deprecated, use grant_revoke_role() 1628 bool revoke_role(1:string role_name, 2:string principal_name, 3:PrincipalType principal_type) 1629 throws(1:MetaException o1) 1630 list<Role> list_roles(1:string principal_name, 2:PrincipalType principal_type) throws(1:MetaException o1) 1631 GrantRevokeRoleResponse grant_revoke_role(1:GrantRevokeRoleRequest request) throws(1:MetaException o1) 1632 1633 // get all role-grants for users/roles that have been granted the given role 1634 // Note that in the returned list of RolePrincipalGrants, the roleName is 1635 // redundant as it would match the role_name argument of this function 1636 GetPrincipalsInRoleResponse get_principals_in_role(1: GetPrincipalsInRoleRequest request) throws(1:MetaException o1) 1637 1638 // get grant information of all roles granted to the given principal 1639 // Note that in the returned list of RolePrincipalGrants, the principal name,type is 1640 // redundant as it would match the principal name,type arguments of this function 1641 GetRoleGrantsForPrincipalResponse get_role_grants_for_principal(1: GetRoleGrantsForPrincipalRequest request) throws(1:MetaException o1) 1642 1643 PrincipalPrivilegeSet get_privilege_set(1:HiveObjectRef hiveObject, 2:string user_name, 1644 3: list<string> group_names) throws(1:MetaException o1) 1645 list<HiveObjectPrivilege> list_privileges(1:string principal_name, 2:PrincipalType principal_type, 1646 3: HiveObjectRef hiveObject) throws(1:MetaException o1) 1647 1648 // Deprecated, use grant_revoke_privileges() 1649 bool grant_privileges(1:PrivilegeBag privileges) throws(1:MetaException o1) 1650 // Deprecated, use grant_revoke_privileges() 1651 bool revoke_privileges(1:PrivilegeBag privileges) throws(1:MetaException o1) 1652 GrantRevokePrivilegeResponse grant_revoke_privileges(1:GrantRevokePrivilegeRequest request) throws(1:MetaException o1); 1653 1654 // this is used by metastore client to send UGI information to metastore server immediately 1655 // after setting up a connection. 1656 list<string> set_ugi(1:string user_name, 2:list<string> group_names) throws (1:MetaException o1) 1657 1658 //Authentication (delegation token) interfaces 1659 1660 // get metastore server delegation token for use from the map/reduce tasks to authenticate 1661 // to metastore server 1662 string get_delegation_token(1:string token_owner, 2:string renewer_kerberos_principal_name) 1663 throws (1:MetaException o1) 1664 1665 // method to renew delegation token obtained from metastore server 1666 i64 renew_delegation_token(1:string token_str_form) throws (1:MetaException o1) 1667 1668 // method to cancel delegation token obtained from metastore server 1669 void cancel_delegation_token(1:string token_str_form) throws (1:MetaException o1) 1670 1671 // add a delegation token 1672 bool add_token(1:string token_identifier, 2:string delegation_token) 1673 1674 // remove a delegation token 1675 bool remove_token(1:string token_identifier) 1676 1677 // get a delegation token by identifier 1678 string get_token(1:string token_identifier) 1679 1680 // get all delegation token identifiers 1681 list<string> get_all_token_identifiers() 1682 1683 // add master key 1684 i32 add_master_key(1:string key) throws (1:MetaException o1) 1685 1686 // update master key 1687 void update_master_key(1:i32 seq_number, 2:string key) throws (1:NoSuchObjectException o1, 2:MetaException o2) 1688 1689 // remove master key 1690 bool remove_master_key(1:i32 key_seq) 1691 1692 // get master keys 1693 list<string> get_master_keys() 1694 1695 // Transaction and lock management calls 1696 // Get just list of open transactions 1697 GetOpenTxnsResponse get_open_txns() 1698 // Get list of open transactions with state (open, aborted) 1699 GetOpenTxnsInfoResponse get_open_txns_info() 1700 OpenTxnsResponse open_txns(1:OpenTxnRequest rqst) 1701 void abort_txn(1:AbortTxnRequest rqst) throws (1:NoSuchTxnException o1) 1702 void abort_txns(1:AbortTxnsRequest rqst) throws (1:NoSuchTxnException o1) 1703 void commit_txn(1:CommitTxnRequest rqst) throws (1:NoSuchTxnException o1, 2:TxnAbortedException o2) 1704 LockResponse lock(1:LockRequest rqst) throws (1:NoSuchTxnException o1, 2:TxnAbortedException o2) 1705 LockResponse check_lock(1:CheckLockRequest rqst) 1706 throws (1:NoSuchTxnException o1, 2:TxnAbortedException o2, 3:NoSuchLockException o3) 1707 void unlock(1:UnlockRequest rqst) throws (1:NoSuchLockException o1, 2:TxnOpenException o2) 1708 ShowLocksResponse show_locks(1:ShowLocksRequest rqst) 1709 void heartbeat(1:HeartbeatRequest ids) throws (1:NoSuchLockException o1, 2:NoSuchTxnException o2, 3:TxnAbortedException o3) 1710 HeartbeatTxnRangeResponse heartbeat_txn_range(1:HeartbeatTxnRangeRequest txns) 1711 void compact(1:CompactionRequest rqst) 1712 CompactionResponse compact2(1:CompactionRequest rqst) 1713 ShowCompactResponse show_compact(1:ShowCompactRequest rqst) 1714 void add_dynamic_partitions(1:AddDynamicPartitions rqst) throws (1:NoSuchTxnException o1, 2:TxnAbortedException o2) 1715 1716 // Notification logging calls 1717 NotificationEventResponse get_next_notification(1:NotificationEventRequest rqst) 1718 CurrentNotificationEventId get_current_notificationEventId() 1719 NotificationEventsCountResponse get_notification_events_count(1:NotificationEventsCountRequest rqst) 1720 FireEventResponse fire_listener_event(1:FireEventRequest rqst) 1721 void flushCache() 1722 1723 // Repl Change Management api 1724 CmRecycleResponse cm_recycle(1:CmRecycleRequest request) throws(1:MetaException o1) 1725 1726 GetFileMetadataByExprResult get_file_metadata_by_expr(1:GetFileMetadataByExprRequest req) 1727 GetFileMetadataResult get_file_metadata(1:GetFileMetadataRequest req) 1728 PutFileMetadataResult put_file_metadata(1:PutFileMetadataRequest req) 1729 ClearFileMetadataResult clear_file_metadata(1:ClearFileMetadataRequest req) 1730 CacheFileMetadataResult cache_file_metadata(1:CacheFileMetadataRequest req) 1731 1732 // Metastore DB properties 1733 string get_metastore_db_uuid() throws (1:MetaException o1) 1734 1735 // Workload management API's 1736 WMCreateResourcePlanResponse create_resource_plan(1:WMCreateResourcePlanRequest request) 1737 throws(1:AlreadyExistsException o1, 2:InvalidObjectException o2, 3:MetaException o3) 1738 1739 WMGetResourcePlanResponse get_resource_plan(1:WMGetResourcePlanRequest request) 1740 throws(1:NoSuchObjectException o1, 2:MetaException o2) 1741 1742 WMGetActiveResourcePlanResponse get_active_resource_plan(1:WMGetActiveResourcePlanRequest request) 1743 throws(1:MetaException o2) 1744 1745 WMGetAllResourcePlanResponse get_all_resource_plans(1:WMGetAllResourcePlanRequest request) 1746 throws(1:MetaException o1) 1747 1748 WMAlterResourcePlanResponse alter_resource_plan(1:WMAlterResourcePlanRequest request) 1749 throws(1:NoSuchObjectException o1, 2:InvalidOperationException o2, 3:MetaException o3) 1750 1751 WMValidateResourcePlanResponse validate_resource_plan(1:WMValidateResourcePlanRequest request) 1752 throws(1:NoSuchObjectException o1, 2:MetaException o2) 1753 1754 WMDropResourcePlanResponse drop_resource_plan(1:WMDropResourcePlanRequest request) 1755 throws(1:NoSuchObjectException o1, 2:InvalidOperationException o2, 3:MetaException o3) 1756 1757 WMCreateTriggerResponse create_wm_trigger(1:WMCreateTriggerRequest request) 1758 throws(1:AlreadyExistsException o1, 2:NoSuchObjectException o2, 3:InvalidObjectException o3, 4:MetaException o4) 1759 1760 WMAlterTriggerResponse alter_wm_trigger(1:WMAlterTriggerRequest request) 1761 throws(1:NoSuchObjectException o1, 2:InvalidObjectException o2, 3:MetaException o3) 1762 1763 WMDropTriggerResponse drop_wm_trigger(1:WMDropTriggerRequest request) 1764 throws(1:NoSuchObjectException o1, 2:InvalidOperationException o2, 3:MetaException o3) 1765 1766 WMGetTriggersForResourePlanResponse get_triggers_for_resourceplan(1:WMGetTriggersForResourePlanRequest request) 1767 throws(1:NoSuchObjectException o1, 2:MetaException o2) 1768 } 1769 1770 // * Note about the DDL_TIME: When creating or altering a table or a partition, 1771 // if the DDL_TIME is not set, the current time will be used. 1772 1773 // For storing info about archived partitions in parameters 1774 1775 // Whether the partition is archived 1776 const string IS_ARCHIVED = "is_archived", 1777 // The original location of the partition, before archiving. After archiving, 1778 // this directory will contain the archive. When the partition 1779 // is dropped, this directory will be deleted 1780 const string ORIGINAL_LOCATION = "original_location", 1781 1782 // Whether or not the table is considered immutable - immutable tables can only be 1783 // overwritten or created if unpartitioned, or if partitioned, partitions inside them 1784 // can only be overwritten or created. Immutability supports write-once and replace 1785 // semantics, but not append. 1786 const string IS_IMMUTABLE = "immutable", 1787 1788 // these should be needed only for backward compatibility with filestore 1789 const string META_TABLE_COLUMNS = "columns", 1790 const string META_TABLE_COLUMN_TYPES = "columns.types", 1791 const string BUCKET_FIELD_NAME = "bucket_field_name", 1792 const string BUCKET_COUNT = "bucket_count", 1793 const string FIELD_TO_DIMENSION = "field_to_dimension", 1794 const string META_TABLE_NAME = "name", 1795 const string META_TABLE_DB = "db", 1796 const string META_TABLE_LOCATION = "location", 1797 const string META_TABLE_SERDE = "serde", 1798 const string META_TABLE_PARTITION_COLUMNS = "partition_columns", 1799 const string META_TABLE_PARTITION_COLUMN_TYPES = "partition_columns.types", 1800 const string FILE_INPUT_FORMAT = "file.inputformat", 1801 const string FILE_OUTPUT_FORMAT = "file.outputformat", 1802 const string META_TABLE_STORAGE = "storage_handler", 1803 const string TABLE_IS_TRANSACTIONAL = "transactional", 1804 const string TABLE_NO_AUTO_COMPACT = "no_auto_compaction", 1805 const string TABLE_TRANSACTIONAL_PROPERTIES = "transactional_properties", 1806 1807