hive_metastore.thrift 50 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308
  1. #!/usr/local/bin/thrift -java
  2. /**
  3. * Licensed to the Apache Software Foundation (ASF) under one
  4. * or more contributor license agreements. See the NOTICE file
  5. * distributed with this work for additional information
  6. * regarding copyright ownership. The ASF licenses this file
  7. * to you under the Apache License, Version 2.0 (the
  8. * "License"); you may not use this file except in compliance
  9. * with the License. You may obtain a copy of the License at
  10. *
  11. * http://www.apache.org/licenses/LICENSE-2.0
  12. *
  13. * Unless required by applicable law or agreed to in writing, software
  14. * distributed under the License is distributed on an "AS IS" BASIS,
  15. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  16. * See the License for the specific language governing permissions and
  17. * limitations under the License.
  18. */
  19. #
  20. # Thrift Service that the MetaStore is built on
  21. #
  22. include "fb303.thrift"
  23. namespace java org.apache.hadoop.hive.metastore.api
  24. namespace php metastore
  25. namespace cpp Apache.Hadoop.Hive
  26. const string DDL_TIME = "transient_lastDdlTime"
  27. struct Version {
  28. 1: string version,
  29. 2: string comments
  30. }
  31. struct FieldSchema {
  32. 1: string name, // name of the field
  33. 2: string type, // type of the field. primitive types defined above, specify list<TYPE_NAME>, map<TYPE_NAME, TYPE_NAME> for lists & maps
  34. 3: string comment
  35. }
  36. struct Type {
  37. 1: string name, // one of the types in PrimitiveTypes or CollectionTypes or User defined types
  38. 2: optional string type1, // object type if the name is 'list' (LIST_TYPE), key type if the name is 'map' (MAP_TYPE)
  39. 3: optional string type2, // val type if the name is 'map' (MAP_TYPE)
  40. 4: optional list<FieldSchema> fields // if the name is one of the user defined types
  41. }
  42. enum HiveObjectType {
  43. GLOBAL = 1,
  44. DATABASE = 2,
  45. TABLE = 3,
  46. PARTITION = 4,
  47. COLUMN = 5,
  48. }
  49. enum PrincipalType {
  50. USER = 1,
  51. ROLE = 2,
  52. GROUP = 3,
  53. }
  54. const string HIVE_FILTER_FIELD_OWNER = "hive_filter_field_owner__"
  55. const string HIVE_FILTER_FIELD_PARAMS = "hive_filter_field_params__"
  56. const string HIVE_FILTER_FIELD_LAST_ACCESS = "hive_filter_field_last_access__"
  57. enum PartitionEventType {
  58. LOAD_DONE = 1,
  59. }
  60. // Enums for transaction and lock management
  61. enum TxnState {
  62. COMMITTED = 1,
  63. ABORTED = 2,
  64. OPEN = 3,
  65. }
  66. enum LockLevel {
  67. DB = 1,
  68. TABLE = 2,
  69. PARTITION = 3,
  70. }
  71. enum LockState {
  72. ACQUIRED = 1, // requester has the lock
  73. WAITING = 2, // requester is waiting for the lock and should call checklock at a later point to see if the lock has been obtained.
  74. ABORT = 3, // the lock has been aborted, most likely due to timeout
  75. NOT_ACQUIRED = 4, // returned only with lockNoWait, indicates the lock was not available and was not acquired
  76. }
  77. enum LockType {
  78. SHARED_READ = 1,
  79. SHARED_WRITE = 2,
  80. EXCLUSIVE = 3,
  81. }
  82. enum CompactionType {
  83. MINOR = 1,
  84. MAJOR = 2,
  85. }
  86. enum GrantRevokeType {
  87. GRANT = 1,
  88. REVOKE = 2,
  89. }
  90. // Types of events the client can request that the metastore fire. For now just support DML operations, as the metastore knows
  91. // about DDL operations and there's no reason for the client to request such an event.
  92. enum EventRequestType {
  93. INSERT = 1,
  94. UPDATE = 2,
  95. DELETE = 3,
  96. }
  97. struct HiveObjectRef{
  98. 1: HiveObjectType objectType,
  99. 2: string dbName,
  100. 3: string objectName,
  101. 4: list<string> partValues,
  102. 5: string columnName,
  103. }
  104. struct PrivilegeGrantInfo {
  105. 1: string privilege,
  106. 2: i32 createTime,
  107. 3: string grantor,
  108. 4: PrincipalType grantorType,
  109. 5: bool grantOption,
  110. }
  111. struct HiveObjectPrivilege {
  112. 1: HiveObjectRef hiveObject,
  113. 2: string principalName,
  114. 3: PrincipalType principalType,
  115. 4: PrivilegeGrantInfo grantInfo,
  116. }
  117. struct PrivilegeBag {
  118. 1: list<HiveObjectPrivilege> privileges,
  119. }
  120. struct PrincipalPrivilegeSet {
  121. 1: map<string, list<PrivilegeGrantInfo>> userPrivileges, // user name -> privilege grant info
  122. 2: map<string, list<PrivilegeGrantInfo>> groupPrivileges, // group name -> privilege grant info
  123. 3: map<string, list<PrivilegeGrantInfo>> rolePrivileges, //role name -> privilege grant info
  124. }
  125. struct GrantRevokePrivilegeRequest {
  126. 1: GrantRevokeType requestType;
  127. 2: PrivilegeBag privileges;
  128. 3: optional bool revokeGrantOption; // Only for revoke request
  129. }
  130. struct GrantRevokePrivilegeResponse {
  131. 1: optional bool success;
  132. }
  133. struct Role {
  134. 1: string roleName,
  135. 2: i32 createTime,
  136. 3: string ownerName,
  137. }
  138. // Representation of a grant for a principal to a role
  139. struct RolePrincipalGrant {
  140. 1: string roleName,
  141. 2: string principalName,
  142. 3: PrincipalType principalType,
  143. 4: bool grantOption,
  144. 5: i32 grantTime,
  145. 6: string grantorName,
  146. 7: PrincipalType grantorPrincipalType
  147. }
  148. struct GetRoleGrantsForPrincipalRequest {
  149. 1: required string principal_name,
  150. 2: required PrincipalType principal_type
  151. }
  152. struct GetRoleGrantsForPrincipalResponse {
  153. 1: required list<RolePrincipalGrant> principalGrants;
  154. }
  155. struct GetPrincipalsInRoleRequest {
  156. 1: required string roleName;
  157. }
  158. struct GetPrincipalsInRoleResponse {
  159. 1: required list<RolePrincipalGrant> principalGrants;
  160. }
  161. struct GrantRevokeRoleRequest {
  162. 1: GrantRevokeType requestType;
  163. 2: string roleName;
  164. 3: string principalName;
  165. 4: PrincipalType principalType;
  166. 5: optional string grantor; // Needed for grant
  167. 6: optional PrincipalType grantorType; // Needed for grant
  168. 7: optional bool grantOption;
  169. }
  170. struct GrantRevokeRoleResponse {
  171. 1: optional bool success;
  172. }
  173. // namespace for tables
  174. struct Database {
  175. 1: string name,
  176. 2: string description,
  177. 3: string locationUri,
  178. 4: map<string, string> parameters, // properties associated with the database
  179. 5: optional PrincipalPrivilegeSet privileges,
  180. 6: optional string ownerName,
  181. 7: optional PrincipalType ownerType
  182. }
  183. // This object holds the information needed by SerDes
  184. struct SerDeInfo {
  185. 1: string name, // name of the serde, table name by default
  186. 2: string serializationLib, // usually the class that implements the extractor & loader
  187. 3: map<string, string> parameters // initialization parameters
  188. }
  189. // sort order of a column (column name along with asc(1)/desc(0))
  190. struct Order {
  191. 1: string col, // sort column name
  192. 2: i32 order // asc(1) or desc(0)
  193. }
  194. // this object holds all the information about skewed table
  195. struct SkewedInfo {
  196. 1: list<string> skewedColNames, // skewed column names
  197. 2: list<list<string>> skewedColValues, //skewed values
  198. 3: map<list<string>, string> skewedColValueLocationMaps, //skewed value to location mappings
  199. }
  200. // this object holds all the information about physical storage of the data belonging to a table
  201. struct StorageDescriptor {
  202. 1: list<FieldSchema> cols, // required (refer to types defined above)
  203. 2: string location, // defaults to <warehouse loc>/<db loc>/tablename
  204. 3: string inputFormat, // SequenceFileInputFormat (binary) or TextInputFormat` or custom format
  205. 4: string outputFormat, // SequenceFileOutputFormat (binary) or IgnoreKeyTextOutputFormat or custom format
  206. 5: bool compressed, // compressed or not
  207. 6: i32 numBuckets, // this must be specified if there are any dimension columns
  208. 7: SerDeInfo serdeInfo, // serialization and deserialization information
  209. 8: list<string> bucketCols, // reducer grouping columns and clustering columns and bucketing columns`
  210. 9: list<Order> sortCols, // sort order of the data in each bucket
  211. 10: map<string, string> parameters, // any user supplied key value hash
  212. 11: optional SkewedInfo skewedInfo, // skewed information
  213. 12: optional bool storedAsSubDirectories // stored as subdirectories or not
  214. }
  215. // table information
  216. struct Table {
  217. 1: string tableName, // name of the table
  218. 2: string dbName, // database name ('default')
  219. 3: string owner, // owner of this table
  220. 4: i32 createTime, // creation time of the table
  221. 5: i32 lastAccessTime, // last access time (usually this will be filled from HDFS and shouldn't be relied on)
  222. 6: i32 retention, // retention time
  223. 7: StorageDescriptor sd, // storage descriptor of the table
  224. 8: list<FieldSchema> partitionKeys, // partition keys of the table. only primitive types are supported
  225. 9: map<string, string> parameters, // to store comments or any other user level parameters
  226. 10: string viewOriginalText, // original view text, null for non-view
  227. 11: string viewExpandedText, // expanded view text, null for non-view
  228. 12: string tableType, // table type enum, e.g. EXTERNAL_TABLE
  229. 13: optional PrincipalPrivilegeSet privileges,
  230. 14: optional bool temporary=false
  231. }
  232. struct Partition {
  233. 1: list<string> values // string value is converted to appropriate partition key type
  234. 2: string dbName,
  235. 3: string tableName,
  236. 4: i32 createTime,
  237. 5: i32 lastAccessTime,
  238. 6: StorageDescriptor sd,
  239. 7: map<string, string> parameters,
  240. 8: optional PrincipalPrivilegeSet privileges
  241. }
  242. struct PartitionWithoutSD {
  243. 1: list<string> values // string value is converted to appropriate partition key type
  244. 2: i32 createTime,
  245. 3: i32 lastAccessTime,
  246. 4: string relativePath,
  247. 5: map<string, string> parameters,
  248. 6: optional PrincipalPrivilegeSet privileges
  249. }
  250. struct PartitionSpecWithSharedSD {
  251. 1: list<PartitionWithoutSD> partitions,
  252. 2: StorageDescriptor sd,
  253. }
  254. struct PartitionListComposingSpec {
  255. 1: list<Partition> partitions
  256. }
  257. struct PartitionSpec {
  258. 1: string dbName,
  259. 2: string tableName,
  260. 3: string rootPath,
  261. 4: optional PartitionSpecWithSharedSD sharedSDPartitionSpec,
  262. 5: optional PartitionListComposingSpec partitionList
  263. }
  264. struct Index {
  265. 1: string indexName, // unique with in the whole database namespace
  266. 2: string indexHandlerClass, // reserved
  267. 3: string dbName,
  268. 4: string origTableName,
  269. 5: i32 createTime,
  270. 6: i32 lastAccessTime,
  271. 7: string indexTableName,
  272. 8: StorageDescriptor sd,
  273. 9: map<string, string> parameters,
  274. 10: bool deferredRebuild
  275. }
  276. // column statistics
  277. struct BooleanColumnStatsData {
  278. 1: required i64 numTrues,
  279. 2: required i64 numFalses,
  280. 3: required i64 numNulls
  281. }
  282. struct DoubleColumnStatsData {
  283. 1: optional double lowValue,
  284. 2: optional double highValue,
  285. 3: required i64 numNulls,
  286. 4: required i64 numDVs
  287. }
  288. struct LongColumnStatsData {
  289. 1: optional i64 lowValue,
  290. 2: optional i64 highValue,
  291. 3: required i64 numNulls,
  292. 4: required i64 numDVs
  293. }
  294. struct StringColumnStatsData {
  295. 1: required i64 maxColLen,
  296. 2: required double avgColLen,
  297. 3: required i64 numNulls,
  298. 4: required i64 numDVs
  299. }
  300. struct BinaryColumnStatsData {
  301. 1: required i64 maxColLen,
  302. 2: required double avgColLen,
  303. 3: required i64 numNulls
  304. }
  305. struct Decimal {
  306. 1: required binary unscaled,
  307. 3: required i16 scale
  308. }
  309. struct DecimalColumnStatsData {
  310. 1: optional Decimal lowValue,
  311. 2: optional Decimal highValue,
  312. 3: required i64 numNulls,
  313. 4: required i64 numDVs
  314. }
  315. struct Date {
  316. 1: required i64 daysSinceEpoch
  317. }
  318. struct DateColumnStatsData {
  319. 1: optional Date lowValue,
  320. 2: optional Date highValue,
  321. 3: required i64 numNulls,
  322. 4: required i64 numDVs
  323. }
  324. union ColumnStatisticsData {
  325. 1: BooleanColumnStatsData booleanStats,
  326. 2: LongColumnStatsData longStats,
  327. 3: DoubleColumnStatsData doubleStats,
  328. 4: StringColumnStatsData stringStats,
  329. 5: BinaryColumnStatsData binaryStats,
  330. 6: DecimalColumnStatsData decimalStats,
  331. 7: DateColumnStatsData dateStats
  332. }
  333. struct ColumnStatisticsObj {
  334. 1: required string colName,
  335. 2: required string colType,
  336. 3: required ColumnStatisticsData statsData
  337. }
  338. struct ColumnStatisticsDesc {
  339. 1: required bool isTblLevel,
  340. 2: required string dbName,
  341. 3: required string tableName,
  342. 4: optional string partName,
  343. 5: optional i64 lastAnalyzed
  344. }
  345. struct ColumnStatistics {
  346. 1: required ColumnStatisticsDesc statsDesc,
  347. 2: required list<ColumnStatisticsObj> statsObj;
  348. }
  349. struct AggrStats {
  350. 1: required list<ColumnStatisticsObj> colStats,
  351. 2: required i64 partsFound // number of partitions for which stats were found
  352. }
  353. struct SetPartitionsStatsRequest {
  354. 1: required list<ColumnStatistics> colStats
  355. }
  356. // schema of the table/query results etc.
  357. struct Schema {
  358. // column names, types, comments
  359. 1: list<FieldSchema> fieldSchemas, // delimiters etc
  360. 2: map<string, string> properties
  361. }
  362. // Key-value store to be used with selected
  363. // Metastore APIs (create, alter methods).
  364. // The client can pass environment properties / configs that can be
  365. // accessed in hooks.
  366. struct EnvironmentContext {
  367. 1: map<string, string> properties
  368. }
  369. // Return type for get_partitions_by_expr
  370. struct PartitionsByExprResult {
  371. 1: required list<Partition> partitions,
  372. // Whether the results has any (currently, all) partitions which may or may not match
  373. 2: required bool hasUnknownPartitions
  374. }
  375. struct PartitionsByExprRequest {
  376. 1: required string dbName,
  377. 2: required string tblName,
  378. 3: required binary expr,
  379. 4: optional string defaultPartitionName,
  380. 5: optional i16 maxParts=-1
  381. }
  382. struct TableStatsResult {
  383. 1: required list<ColumnStatisticsObj> tableStats
  384. }
  385. struct PartitionsStatsResult {
  386. 1: required map<string, list<ColumnStatisticsObj>> partStats
  387. }
  388. struct TableStatsRequest {
  389. 1: required string dbName,
  390. 2: required string tblName,
  391. 3: required list<string> colNames
  392. }
  393. struct PartitionsStatsRequest {
  394. 1: required string dbName,
  395. 2: required string tblName,
  396. 3: required list<string> colNames,
  397. 4: required list<string> partNames
  398. }
  399. // Return type for add_partitions_req
  400. struct AddPartitionsResult {
  401. 1: optional list<Partition> partitions,
  402. }
  403. // Request type for add_partitions_req
  404. struct AddPartitionsRequest {
  405. 1: required string dbName,
  406. 2: required string tblName,
  407. 3: required list<Partition> parts,
  408. 4: required bool ifNotExists,
  409. 5: optional bool needResult=true
  410. }
  411. // Return type for drop_partitions_req
  412. struct DropPartitionsResult {
  413. 1: optional list<Partition> partitions,
  414. }
  415. struct DropPartitionsExpr {
  416. 1: required binary expr;
  417. 2: optional i32 partArchiveLevel;
  418. }
  419. union RequestPartsSpec {
  420. 1: list<string> names;
  421. 2: list<DropPartitionsExpr> exprs;
  422. }
  423. // Request type for drop_partitions_req
  424. // TODO: we might want to add "bestEffort" flag; where a subset can fail
  425. struct DropPartitionsRequest {
  426. 1: required string dbName,
  427. 2: required string tblName,
  428. 3: required RequestPartsSpec parts,
  429. 4: optional bool deleteData,
  430. 5: optional bool ifExists=true, // currently verified on client
  431. 6: optional bool ignoreProtection,
  432. 7: optional EnvironmentContext environmentContext,
  433. 8: optional bool needResult=true
  434. }
  435. enum FunctionType {
  436. JAVA = 1,
  437. }
  438. enum ResourceType {
  439. JAR = 1,
  440. FILE = 2,
  441. ARCHIVE = 3,
  442. }
  443. struct ResourceUri {
  444. 1: ResourceType resourceType,
  445. 2: string uri,
  446. }
  447. // User-defined function
  448. struct Function {
  449. 1: string functionName,
  450. 2: string dbName,
  451. 3: string className,
  452. 4: string ownerName,
  453. 5: PrincipalType ownerType,
  454. 6: i32 createTime,
  455. 7: FunctionType functionType,
  456. 8: list<ResourceUri> resourceUris,
  457. }
  458. // Structs for transaction and locks
  459. struct TxnInfo {
  460. 1: required i64 id,
  461. 2: required TxnState state,
  462. 3: required string user, // used in 'show transactions' to help admins find who has open transactions
  463. 4: required string hostname, // used in 'show transactions' to help admins find who has open transactions
  464. }
  465. struct GetOpenTxnsInfoResponse {
  466. 1: required i64 txn_high_water_mark,
  467. 2: required list<TxnInfo> open_txns,
  468. }
  469. struct GetOpenTxnsResponse {
  470. 1: required i64 txn_high_water_mark,
  471. 2: required set<i64> open_txns,
  472. }
  473. struct OpenTxnRequest {
  474. 1: required i32 num_txns,
  475. 2: required string user,
  476. 3: required string hostname,
  477. }
  478. struct OpenTxnsResponse {
  479. 1: required list<i64> txn_ids,
  480. }
  481. struct AbortTxnRequest {
  482. 1: required i64 txnid,
  483. }
  484. struct CommitTxnRequest {
  485. 1: required i64 txnid,
  486. }
  487. struct LockComponent {
  488. 1: required LockType type,
  489. 2: required LockLevel level,
  490. 3: required string dbname,
  491. 4: optional string tablename,
  492. 5: optional string partitionname,
  493. }
  494. struct LockRequest {
  495. 1: required list<LockComponent> component,
  496. 2: optional i64 txnid,
  497. 3: required string user, // used in 'show locks' to help admins find who has open locks
  498. 4: required string hostname, // used in 'show locks' to help admins find who has open locks
  499. }
  500. struct LockResponse {
  501. 1: required i64 lockid,
  502. 2: required LockState state,
  503. }
  504. struct CheckLockRequest {
  505. 1: required i64 lockid,
  506. }
  507. struct UnlockRequest {
  508. 1: required i64 lockid,
  509. }
  510. struct ShowLocksRequest {
  511. }
  512. struct ShowLocksResponseElement {
  513. 1: required i64 lockid,
  514. 2: required string dbname,
  515. 3: optional string tablename,
  516. 4: optional string partname,
  517. 5: required LockState state,
  518. 6: required LockType type,
  519. 7: optional i64 txnid,
  520. 8: required i64 lastheartbeat,
  521. 9: optional i64 acquiredat,
  522. 10: required string user,
  523. 11: required string hostname,
  524. }
  525. struct ShowLocksResponse {
  526. 1: list<ShowLocksResponseElement> locks,
  527. }
  528. struct HeartbeatRequest {
  529. 1: optional i64 lockid,
  530. 2: optional i64 txnid
  531. }
  532. struct HeartbeatTxnRangeRequest {
  533. 1: required i64 min,
  534. 2: required i64 max
  535. }
  536. struct HeartbeatTxnRangeResponse {
  537. 1: required set<i64> aborted,
  538. 2: required set<i64> nosuch
  539. }
  540. struct CompactionRequest {
  541. 1: required string dbname,
  542. 2: required string tablename,
  543. 3: optional string partitionname,
  544. 4: required CompactionType type,
  545. 5: optional string runas,
  546. }
  547. struct ShowCompactRequest {
  548. }
  549. struct ShowCompactResponseElement {
  550. 1: required string dbname,
  551. 2: required string tablename,
  552. 3: optional string partitionname,
  553. 4: required CompactionType type,
  554. 5: required string state,
  555. 6: optional string workerid,
  556. 7: optional i64 start,
  557. 8: optional string runAs,
  558. }
  559. struct ShowCompactResponse {
  560. 1: required list<ShowCompactResponseElement> compacts,
  561. }
  562. struct AddDynamicPartitions {
  563. 1: required i64 txnid,
  564. 2: required string dbname,
  565. 3: required string tablename,
  566. 4: required list<string> partitionnames,
  567. }
  568. struct NotificationEventRequest {
  569. 1: required i64 lastEvent,
  570. 2: optional i32 maxEvents,
  571. }
  572. struct NotificationEvent {
  573. 1: required i64 eventId,
  574. 2: required i32 eventTime,
  575. 3: required string eventType,
  576. 4: optional string dbName,
  577. 5: optional string tableName,
  578. 6: required string message,
  579. }
  580. struct NotificationEventResponse {
  581. 1: required list<NotificationEvent> events,
  582. }
  583. struct CurrentNotificationEventId {
  584. 1: required i64 eventId,
  585. }
  586. struct InsertEventRequestData {
  587. 1: required list<string> filesAdded
  588. }
  589. union FireEventRequestData {
  590. 1: InsertEventRequestData insertData
  591. }
  592. struct FireEventRequest {
  593. 1: required bool successful,
  594. 2: required FireEventRequestData data
  595. // dbname, tablename, and partition vals are included as optional in the top level event rather than placed in each type of
  596. // subevent as I assume they'll be used across most event types.
  597. 3: optional string dbName,
  598. 4: optional string tableName,
  599. 5: optional list<string> partitionVals,
  600. }
  601. struct FireEventResponse {
  602. // NOP for now, this is just a place holder for future responses
  603. }
  604. struct MetadataPpdResult {
  605. 1: optional binary metadata,
  606. 2: optional binary includeBitset
  607. }
  608. // Return type for get_file_metadata_by_expr
  609. struct GetFileMetadataByExprResult {
  610. 1: required map<i64, MetadataPpdResult> metadata,
  611. 2: required bool isSupported
  612. }
  613. enum FileMetadataExprType {
  614. ORC_SARG = 1
  615. }
  616. // Request type for get_file_metadata_by_expr
  617. struct GetFileMetadataByExprRequest {
  618. 1: required list<i64> fileIds,
  619. 2: required binary expr,
  620. 3: optional bool doGetFooters,
  621. 4: optional FileMetadataExprType type
  622. }
  623. // Return type for get_file_metadata
  624. struct GetFileMetadataResult {
  625. 1: required map<i64, binary> metadata,
  626. 2: required bool isSupported
  627. }
  628. // Request type for get_file_metadata
  629. struct GetFileMetadataRequest {
  630. 1: required list<i64> fileIds
  631. }
  632. // Return type for put_file_metadata
  633. struct PutFileMetadataResult {
  634. }
  635. // Request type for put_file_metadata
  636. struct PutFileMetadataRequest {
  637. 1: required list<i64> fileIds,
  638. 2: required list<binary> metadata
  639. }
  640. // Return type for clear_file_metadata
  641. struct ClearFileMetadataResult {
  642. }
  643. // Request type for clear_file_metadata
  644. struct ClearFileMetadataRequest {
  645. 1: required list<i64> fileIds
  646. }
  647. struct GetAllFunctionsResponse {
  648. 1: optional list<Function> functions
  649. }
  650. struct TableMeta {
  651. 1: required string dbName;
  652. 2: required string tableName;
  653. 3: required string tableType;
  654. 4: optional string comments;
  655. }
  656. exception MetaException {
  657. 1: string message
  658. }
  659. exception UnknownTableException {
  660. 1: string message
  661. }
  662. exception UnknownDBException {
  663. 1: string message
  664. }
  665. exception AlreadyExistsException {
  666. 1: string message
  667. }
  668. exception InvalidPartitionException {
  669. 1: string message
  670. }
  671. exception UnknownPartitionException {
  672. 1: string message
  673. }
  674. exception InvalidObjectException {
  675. 1: string message
  676. }
  677. exception NoSuchObjectException {
  678. 1: string message
  679. }
  680. exception IndexAlreadyExistsException {
  681. 1: string message
  682. }
  683. exception InvalidOperationException {
  684. 1: string message
  685. }
  686. exception ConfigValSecurityException {
  687. 1: string message
  688. }
  689. exception InvalidInputException {
  690. 1: string message
  691. }
  692. // Transaction and lock exceptions
  693. exception NoSuchTxnException {
  694. 1: string message
  695. }
  696. exception TxnAbortedException {
  697. 1: string message
  698. }
  699. exception TxnOpenException {
  700. 1: string message
  701. }
  702. exception NoSuchLockException {
  703. 1: string message
  704. }
  705. /**
  706. * This interface is live.
  707. */
  708. service ThriftHiveMetastore extends fb303.FacebookService
  709. {
  710. string getMetaConf(1:string key) throws(1:MetaException o1)
  711. void setMetaConf(1:string key, 2:string value) throws(1:MetaException o1)
  712. void create_database(1:Database database) throws(1:AlreadyExistsException o1, 2:InvalidObjectException o2, 3:MetaException o3)
  713. Database get_database(1:string name) throws(1:NoSuchObjectException o1, 2:MetaException o2)
  714. void drop_database(1:string name, 2:bool deleteData, 3:bool cascade) throws(1:NoSuchObjectException o1, 2:InvalidOperationException o2, 3:MetaException o3)
  715. list<string> get_databases(1:string pattern) throws(1:MetaException o1)
  716. list<string> get_all_databases() throws(1:MetaException o1)
  717. void alter_database(1:string dbname, 2:Database db) throws(1:MetaException o1, 2:NoSuchObjectException o2)
  718. // returns the type with given name (make seperate calls for the dependent types if needed)
  719. Type get_type(1:string name) throws(1:MetaException o1, 2:NoSuchObjectException o2)
  720. bool create_type(1:Type type) throws(1:AlreadyExistsException o1, 2:InvalidObjectException o2, 3:MetaException o3)
  721. bool drop_type(1:string type) throws(1:MetaException o1, 2:NoSuchObjectException o2)
  722. map<string, Type> get_type_all(1:string name)
  723. throws(1:MetaException o2)
  724. // Gets a list of FieldSchemas describing the columns of a particular table
  725. list<FieldSchema> get_fields(1: string db_name, 2: string table_name) throws (1: MetaException o1, 2: UnknownTableException o2, 3: UnknownDBException o3),
  726. 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)
  727. // Gets a list of FieldSchemas describing both the columns and the partition keys of a particular table
  728. list<FieldSchema> get_schema(1: string db_name, 2: string table_name) throws (1: MetaException o1, 2: UnknownTableException o2, 3: UnknownDBException o3)
  729. 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)
  730. // create a Hive table. Following fields must be set
  731. // tableName
  732. // database (only 'default' for now until Hive QL supports databases)
  733. // owner (not needed, but good to have for tracking purposes)
  734. // sd.cols (list of field schemas)
  735. // sd.inputFormat (SequenceFileInputFormat (binary like falcon tables or u_full) or TextInputFormat)
  736. // sd.outputFormat (SequenceFileInputFormat (binary) or TextInputFormat)
  737. // sd.serdeInfo.serializationLib (SerDe class name eg org.apache.hadoop.hive.serde.simple_meta.MetadataTypedColumnsetSerDe
  738. // * See notes on DDL_TIME
  739. void create_table(1:Table tbl) throws(1:AlreadyExistsException o1, 2:InvalidObjectException o2, 3:MetaException o3, 4:NoSuchObjectException o4)
  740. void create_table_with_environment_context(1:Table tbl,
  741. 2:EnvironmentContext environment_context)
  742. throws (1:AlreadyExistsException o1,
  743. 2:InvalidObjectException o2, 3:MetaException o3,
  744. 4:NoSuchObjectException o4)
  745. // drops the table and all the partitions associated with it if the table has partitions
  746. // delete data (including partitions) if deleteData is set to true
  747. void drop_table(1:string dbname, 2:string name, 3:bool deleteData)
  748. throws(1:NoSuchObjectException o1, 2:MetaException o3)
  749. void drop_table_with_environment_context(1:string dbname, 2:string name, 3:bool deleteData,
  750. 4:EnvironmentContext environment_context)
  751. throws(1:NoSuchObjectException o1, 2:MetaException o3)
  752. list<string> get_tables(1: string db_name, 2: string pattern) throws (1: MetaException o1)
  753. list<TableMeta> get_table_meta(1: string db_patterns, 2: string tbl_patterns, 3: list<string> tbl_types)
  754. throws (1: MetaException o1)
  755. list<string> get_all_tables(1: string db_name) throws (1: MetaException o1)
  756. Table get_table(1:string dbname, 2:string tbl_name)
  757. throws (1:MetaException o1, 2:NoSuchObjectException o2)
  758. list<Table> get_table_objects_by_name(1:string dbname, 2:list<string> tbl_names)
  759. throws (1:MetaException o1, 2:InvalidOperationException o2, 3:UnknownDBException o3)
  760. // Get a list of table names that match a filter.
  761. // The filter operators are LIKE, <, <=, >, >=, =, <>
  762. //
  763. // In the filter statement, values interpreted as strings must be enclosed in quotes,
  764. // while values interpreted as integers should not be. Strings and integers are the only
  765. // supported value types.
  766. //
  767. // The currently supported key names in the filter are:
  768. // Constants.HIVE_FILTER_FIELD_OWNER, which filters on the tables' owner's name
  769. // and supports all filter operators
  770. // Constants.HIVE_FILTER_FIELD_LAST_ACCESS, which filters on the last access times
  771. // and supports all filter operators except LIKE
  772. // Constants.HIVE_FILTER_FIELD_PARAMS, which filters on the tables' parameter keys and values
  773. // and only supports the filter operators = and <>.
  774. // Append the parameter key name to HIVE_FILTER_FIELD_PARAMS in the filter statement.
  775. // For example, to filter on parameter keys called "retention", the key name in the filter
  776. // statement should be Constants.HIVE_FILTER_FIELD_PARAMS + "retention"
  777. // Also, = and <> only work for keys that exist
  778. // in the tables. E.g., if you are looking for tables where key1 <> value, it will only
  779. // look at tables that have a value for the parameter key1.
  780. // Some example filter statements include:
  781. // filter = Constants.HIVE_FILTER_FIELD_OWNER + " like \".*test.*\" and " +
  782. // Constants.HIVE_FILTER_FIELD_LAST_ACCESS + " = 0";
  783. // filter = Constants.HIVE_FILTER_FIELD_PARAMS + "retention = \"30\" or " +
  784. // Constants.HIVE_FILTER_FIELD_PARAMS + "retention = \"90\""
  785. // @param dbName
  786. // The name of the database from which you will retrieve the table names
  787. // @param filterType
  788. // The type of filter
  789. // @param filter
  790. // The filter string
  791. // @param max_tables
  792. // The maximum number of tables returned
  793. // @return A list of table names that match the desired filter
  794. list<string> get_table_names_by_filter(1:string dbname, 2:string filter, 3:i16 max_tables=-1)
  795. throws (1:MetaException o1, 2:InvalidOperationException o2, 3:UnknownDBException o3)
  796. // alter table applies to only future partitions not for existing partitions
  797. // * See notes on DDL_TIME
  798. void alter_table(1:string dbname, 2:string tbl_name, 3:Table new_tbl)
  799. throws (1:InvalidOperationException o1, 2:MetaException o2)
  800. void alter_table_with_environment_context(1:string dbname, 2:string tbl_name,
  801. 3:Table new_tbl, 4:EnvironmentContext environment_context)
  802. throws (1:InvalidOperationException o1, 2:MetaException o2)
  803. // alter table not only applies to future partitions but also cascade to existing partitions
  804. void alter_table_with_cascade(1:string dbname, 2:string tbl_name, 3:Table new_tbl, 4:bool cascade)
  805. throws (1:InvalidOperationException o1, 2:MetaException o2)
  806. // the following applies to only tables that have partitions
  807. // * See notes on DDL_TIME
  808. Partition add_partition(1:Partition new_part)
  809. throws(1:InvalidObjectException o1, 2:AlreadyExistsException o2, 3:MetaException o3)
  810. Partition add_partition_with_environment_context(1:Partition new_part,
  811. 2:EnvironmentContext environment_context)
  812. throws (1:InvalidObjectException o1, 2:AlreadyExistsException o2,
  813. 3:MetaException o3)
  814. i32 add_partitions(1:list<Partition> new_parts)
  815. throws(1:InvalidObjectException o1, 2:AlreadyExistsException o2, 3:MetaException o3)
  816. i32 add_partitions_pspec(1:list<PartitionSpec> new_parts)
  817. throws(1:InvalidObjectException o1, 2:AlreadyExistsException o2, 3:MetaException o3)
  818. Partition append_partition(1:string db_name, 2:string tbl_name, 3:list<string> part_vals)
  819. throws (1:InvalidObjectException o1, 2:AlreadyExistsException o2, 3:MetaException o3)
  820. AddPartitionsResult add_partitions_req(1:AddPartitionsRequest request)
  821. throws(1:InvalidObjectException o1, 2:AlreadyExistsException o2, 3:MetaException o3)
  822. Partition append_partition_with_environment_context(1:string db_name, 2:string tbl_name,
  823. 3:list<string> part_vals, 4:EnvironmentContext environment_context)
  824. throws (1:InvalidObjectException o1, 2:AlreadyExistsException o2, 3:MetaException o3)
  825. Partition append_partition_by_name(1:string db_name, 2:string tbl_name, 3:string part_name)
  826. throws (1:InvalidObjectException o1, 2:AlreadyExistsException o2, 3:MetaException o3)
  827. Partition append_partition_by_name_with_environment_context(1:string db_name, 2:string tbl_name,
  828. 3:string part_name, 4:EnvironmentContext environment_context)
  829. throws (1:InvalidObjectException o1, 2:AlreadyExistsException o2, 3:MetaException o3)
  830. bool drop_partition(1:string db_name, 2:string tbl_name, 3:list<string> part_vals, 4:bool deleteData)
  831. throws(1:NoSuchObjectException o1, 2:MetaException o2)
  832. bool drop_partition_with_environment_context(1:string db_name, 2:string tbl_name,
  833. 3:list<string> part_vals, 4:bool deleteData, 5:EnvironmentContext environment_context)
  834. throws(1:NoSuchObjectException o1, 2:MetaException o2)
  835. bool drop_partition_by_name(1:string db_name, 2:string tbl_name, 3:string part_name, 4:bool deleteData)
  836. throws(1:NoSuchObjectException o1, 2:MetaException o2)
  837. bool drop_partition_by_name_with_environment_context(1:string db_name, 2:string tbl_name,
  838. 3:string part_name, 4:bool deleteData, 5:EnvironmentContext environment_context)
  839. throws(1:NoSuchObjectException o1, 2:MetaException o2)
  840. DropPartitionsResult drop_partitions_req(1: DropPartitionsRequest req)
  841. throws(1:NoSuchObjectException o1, 2:MetaException o2)
  842. Partition get_partition(1:string db_name, 2:string tbl_name, 3:list<string> part_vals)
  843. throws(1:MetaException o1, 2:NoSuchObjectException o2)
  844. Partition exchange_partition(1:map<string, string> partitionSpecs, 2:string source_db,
  845. 3:string source_table_name, 4:string dest_db, 5:string dest_table_name)
  846. throws(1:MetaException o1, 2:NoSuchObjectException o2, 3:InvalidObjectException o3,
  847. 4:InvalidInputException o4)
  848. list<Partition> exchange_partitions(1:map<string, string> partitionSpecs, 2:string source_db,
  849. 3:string source_table_name, 4:string dest_db, 5:string dest_table_name)
  850. throws(1:MetaException o1, 2:NoSuchObjectException o2, 3:InvalidObjectException o3,
  851. 4:InvalidInputException o4)
  852. Partition get_partition_with_auth(1:string db_name, 2:string tbl_name, 3:list<string> part_vals,
  853. 4: string user_name, 5: list<string> group_names) throws(1:MetaException o1, 2:NoSuchObjectException o2)
  854. Partition get_partition_by_name(1:string db_name 2:string tbl_name, 3:string part_name)
  855. throws(1:MetaException o1, 2:NoSuchObjectException o2)
  856. // returns all the partitions for this table in reverse chronological order.
  857. // If max parts is given then it will return only that many.
  858. list<Partition> get_partitions(1:string db_name, 2:string tbl_name, 3:i16 max_parts=-1)
  859. throws(1:NoSuchObjectException o1, 2:MetaException o2)
  860. list<Partition> get_partitions_with_auth(1:string db_name, 2:string tbl_name, 3:i16 max_parts=-1,
  861. 4: string user_name, 5: list<string> group_names) throws(1:NoSuchObjectException o1, 2:MetaException o2)
  862. list<PartitionSpec> get_partitions_pspec(1:string db_name, 2:string tbl_name, 3:i32 max_parts=-1)
  863. throws(1:NoSuchObjectException o1, 2:MetaException o2)
  864. list<string> get_partition_names(1:string db_name, 2:string tbl_name, 3:i16 max_parts=-1)
  865. throws(1:MetaException o2)
  866. // get_partition*_ps methods allow filtering by a partial partition specification,
  867. // as needed for dynamic partitions. The values that are not restricted should
  868. // be empty strings. Nulls were considered (instead of "") but caused errors in
  869. // generated Python code. The size of part_vals may be smaller than the
  870. // number of partition columns - the unspecified values are considered the same
  871. // as "".
  872. list<Partition> get_partitions_ps(1:string db_name 2:string tbl_name
  873. 3:list<string> part_vals, 4:i16 max_parts=-1)
  874. throws(1:MetaException o1, 2:NoSuchObjectException o2)
  875. 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,
  876. 5: string user_name, 6: list<string> group_names) throws(1:NoSuchObjectException o1, 2:MetaException o2)
  877. list<string> get_partition_names_ps(1:string db_name,
  878. 2:string tbl_name, 3:list<string> part_vals, 4:i16 max_parts=-1)
  879. throws(1:MetaException o1, 2:NoSuchObjectException o2)
  880. // get the partitions matching the given partition filter
  881. list<Partition> get_partitions_by_filter(1:string db_name 2:string tbl_name
  882. 3:string filter, 4:i16 max_parts=-1)
  883. throws(1:MetaException o1, 2:NoSuchObjectException o2)
  884. // List partitions as PartitionSpec instances.
  885. list<PartitionSpec> get_part_specs_by_filter(1:string db_name 2:string tbl_name
  886. 3:string filter, 4:i32 max_parts=-1)
  887. throws(1:MetaException o1, 2:NoSuchObjectException o2)
  888. // get the partitions matching the given partition filter
  889. // unlike get_partitions_by_filter, takes serialized hive expression, and with that can work
  890. // with any filter (get_partitions_by_filter only works if the filter can be pushed down to JDOQL.
  891. PartitionsByExprResult get_partitions_by_expr(1:PartitionsByExprRequest req)
  892. throws(1:MetaException o1, 2:NoSuchObjectException o2)
  893. // get partitions give a list of partition names
  894. list<Partition> get_partitions_by_names(1:string db_name 2:string tbl_name 3:list<string> names)
  895. throws(1:MetaException o1, 2:NoSuchObjectException o2)
  896. // changes the partition to the new partition object. partition is identified from the part values
  897. // in the new_part
  898. // * See notes on DDL_TIME
  899. void alter_partition(1:string db_name, 2:string tbl_name, 3:Partition new_part)
  900. throws (1:InvalidOperationException o1, 2:MetaException o2)
  901. // change a list of partitions. All partitions are altered atomically and all
  902. // prehooks are fired together followed by all post hooks
  903. void alter_partitions(1:string db_name, 2:string tbl_name, 3:list<Partition> new_parts)
  904. throws (1:InvalidOperationException o1, 2:MetaException o2)
  905. void alter_partition_with_environment_context(1:string db_name,
  906. 2:string tbl_name, 3:Partition new_part,
  907. 4:EnvironmentContext environment_context)
  908. throws (1:InvalidOperationException o1, 2:MetaException o2)
  909. // rename the old partition to the new partition object by changing old part values to the part values
  910. // in the new_part. old partition is identified from part_vals.
  911. // partition keys in new_part should be the same as those in old partition.
  912. void rename_partition(1:string db_name, 2:string tbl_name, 3:list<string> part_vals, 4:Partition new_part)
  913. throws (1:InvalidOperationException o1, 2:MetaException o2)
  914. // returns whether or not the partition name is valid based on the value of the config
  915. // hive.metastore.partition.name.whitelist.pattern
  916. bool partition_name_has_valid_characters(1:list<string> part_vals, 2:bool throw_exception)
  917. throws(1: MetaException o1)
  918. // gets the value of the configuration key in the metastore server. returns
  919. // defaultValue if the key does not exist. if the configuration key does not
  920. // begin with "hive", "mapred", or "hdfs", a ConfigValSecurityException is
  921. // thrown.
  922. string get_config_value(1:string name, 2:string defaultValue)
  923. throws(1:ConfigValSecurityException o1)
  924. // converts a partition name into a partition values array
  925. list<string> partition_name_to_vals(1: string part_name)
  926. throws(1: MetaException o1)
  927. // converts a partition name into a partition specification (a mapping from
  928. // the partition cols to the values)
  929. map<string, string> partition_name_to_spec(1: string part_name)
  930. throws(1: MetaException o1)
  931. void markPartitionForEvent(1:string db_name, 2:string tbl_name, 3:map<string,string> part_vals,
  932. 4:PartitionEventType eventType) throws (1: MetaException o1, 2: NoSuchObjectException o2,
  933. 3: UnknownDBException o3, 4: UnknownTableException o4, 5: UnknownPartitionException o5,
  934. 6: InvalidPartitionException o6)
  935. bool isPartitionMarkedForEvent(1:string db_name, 2:string tbl_name, 3:map<string,string> part_vals,
  936. 4: PartitionEventType eventType) throws (1: MetaException o1, 2:NoSuchObjectException o2,
  937. 3: UnknownDBException o3, 4: UnknownTableException o4, 5: UnknownPartitionException o5,
  938. 6: InvalidPartitionException o6)
  939. //index
  940. Index add_index(1:Index new_index, 2: Table index_table)
  941. throws(1:InvalidObjectException o1, 2:AlreadyExistsException o2, 3:MetaException o3)
  942. void alter_index(1:string dbname, 2:string base_tbl_name, 3:string idx_name, 4:Index new_idx)
  943. throws (1:InvalidOperationException o1, 2:MetaException o2)
  944. bool drop_index_by_name(1:string db_name, 2:string tbl_name, 3:string index_name, 4:bool deleteData)
  945. throws(1:NoSuchObjectException o1, 2:MetaException o2)
  946. Index get_index_by_name(1:string db_name 2:string tbl_name, 3:string index_name)
  947. throws(1:MetaException o1, 2:NoSuchObjectException o2)
  948. list<Index> get_indexes(1:string db_name, 2:string tbl_name, 3:i16 max_indexes=-1)
  949. throws(1:NoSuchObjectException o1, 2:MetaException o2)
  950. list<string> get_index_names(1:string db_name, 2:string tbl_name, 3:i16 max_indexes=-1)
  951. throws(1:MetaException o2)
  952. // column statistics interfaces
  953. // update APIs persist the column statistics object(s) that are passed in. If statistics already
  954. // exists for one or more columns, the existing statistics will be overwritten. The update APIs
  955. // validate that the dbName, tableName, partName, colName[] passed in as part of the ColumnStatistics
  956. // struct are valid, throws InvalidInputException/NoSuchObjectException if found to be invalid
  957. bool update_table_column_statistics(1:ColumnStatistics stats_obj) throws (1:NoSuchObjectException o1,
  958. 2:InvalidObjectException o2, 3:MetaException o3, 4:InvalidInputException o4)
  959. bool update_partition_column_statistics(1:ColumnStatistics stats_obj) throws (1:NoSuchObjectException o1,
  960. 2:InvalidObjectException o2, 3:MetaException o3, 4:InvalidInputException o4)
  961. // get APIs return the column statistics corresponding to db_name, tbl_name, [part_name], col_name if
  962. // such statistics exists. If the required statistics doesn't exist, get APIs throw NoSuchObjectException
  963. // For instance, if get_table_column_statistics is called on a partitioned table for which only
  964. // partition level column stats exist, get_table_column_statistics will throw NoSuchObjectException
  965. ColumnStatistics get_table_column_statistics(1:string db_name, 2:string tbl_name, 3:string col_name) throws
  966. (1:NoSuchObjectException o1, 2:MetaException o2, 3:InvalidInputException o3, 4:InvalidObjectException o4)
  967. ColumnStatistics get_partition_column_statistics(1:string db_name, 2:string tbl_name, 3:string part_name,
  968. 4:string col_name) throws (1:NoSuchObjectException o1, 2:MetaException o2,
  969. 3:InvalidInputException o3, 4:InvalidObjectException o4)
  970. TableStatsResult get_table_statistics_req(1:TableStatsRequest request) throws
  971. (1:NoSuchObjectException o1, 2:MetaException o2)
  972. PartitionsStatsResult get_partitions_statistics_req(1:PartitionsStatsRequest request) throws
  973. (1:NoSuchObjectException o1, 2:MetaException o2)
  974. AggrStats get_aggr_stats_for(1:PartitionsStatsRequest request) throws
  975. (1:NoSuchObjectException o1, 2:MetaException o2)
  976. bool set_aggr_stats_for(1:SetPartitionsStatsRequest request) throws
  977. (1:NoSuchObjectException o1, 2:InvalidObjectException o2, 3:MetaException o3, 4:InvalidInputException o4)
  978. // delete APIs attempt to delete column statistics, if found, associated with a given db_name, tbl_name, [part_name]
  979. // and col_name. If the delete API doesn't find the statistics record in the metastore, throws NoSuchObjectException
  980. // Delete API validates the input and if the input is invalid throws InvalidInputException/InvalidObjectException.
  981. bool delete_partition_column_statistics(1:string db_name, 2:string tbl_name, 3:string part_name, 4:string col_name) throws
  982. (1:NoSuchObjectException o1, 2:MetaException o2, 3:InvalidObjectException o3,
  983. 4:InvalidInputException o4)
  984. bool delete_table_column_statistics(1:string db_name, 2:string tbl_name, 3:string col_name) throws
  985. (1:NoSuchObjectException o1, 2:MetaException o2, 3:InvalidObjectException o3,
  986. 4:InvalidInputException o4)
  987. //
  988. // user-defined functions
  989. //
  990. void create_function(1:Function func)
  991. throws (1:AlreadyExistsException o1,
  992. 2:InvalidObjectException o2,
  993. 3:MetaException o3,
  994. 4:NoSuchObjectException o4)
  995. void drop_function(1:string dbName, 2:string funcName)
  996. throws (1:NoSuchObjectException o1, 2:MetaException o3)
  997. void alter_function(1:string dbName, 2:string funcName, 3:Function newFunc)
  998. throws (1:InvalidOperationException o1, 2:MetaException o2)
  999. list<string> get_functions(1:string dbName, 2:string pattern)
  1000. throws (1:MetaException o1)
  1001. Function get_function(1:string dbName, 2:string funcName)
  1002. throws (1:MetaException o1, 2:NoSuchObjectException o2)
  1003. GetAllFunctionsResponse get_all_functions() throws (1:MetaException o1)
  1004. //authorization privileges
  1005. bool create_role(1:Role role) throws(1:MetaException o1)
  1006. bool drop_role(1:string role_name) throws(1:MetaException o1)
  1007. list<string> get_role_names() throws(1:MetaException o1)
  1008. // Deprecated, use grant_revoke_role()
  1009. bool grant_role(1:string role_name, 2:string principal_name, 3:PrincipalType principal_type,
  1010. 4:string grantor, 5:PrincipalType grantorType, 6:bool grant_option) throws(1:MetaException o1)
  1011. // Deprecated, use grant_revoke_role()
  1012. bool revoke_role(1:string role_name, 2:string principal_name, 3:PrincipalType principal_type)
  1013. throws(1:MetaException o1)
  1014. list<Role> list_roles(1:string principal_name, 2:PrincipalType principal_type) throws(1:MetaException o1)
  1015. GrantRevokeRoleResponse grant_revoke_role(1:GrantRevokeRoleRequest request) throws(1:MetaException o1)
  1016. // get all role-grants for users/roles that have been granted the given role
  1017. // Note that in the returned list of RolePrincipalGrants, the roleName is
  1018. // redundant as it would match the role_name argument of this function
  1019. GetPrincipalsInRoleResponse get_principals_in_role(1: GetPrincipalsInRoleRequest request) throws(1:MetaException o1)
  1020. // get grant information of all roles granted to the given principal
  1021. // Note that in the returned list of RolePrincipalGrants, the principal name,type is
  1022. // redundant as it would match the principal name,type arguments of this function
  1023. GetRoleGrantsForPrincipalResponse get_role_grants_for_principal(1: GetRoleGrantsForPrincipalRequest request) throws(1:MetaException o1)
  1024. PrincipalPrivilegeSet get_privilege_set(1:HiveObjectRef hiveObject, 2:string user_name,
  1025. 3: list<string> group_names) throws(1:MetaException o1)
  1026. list<HiveObjectPrivilege> list_privileges(1:string principal_name, 2:PrincipalType principal_type,
  1027. 3: HiveObjectRef hiveObject) throws(1:MetaException o1)
  1028. // Deprecated, use grant_revoke_privileges()
  1029. bool grant_privileges(1:PrivilegeBag privileges) throws(1:MetaException o1)
  1030. // Deprecated, use grant_revoke_privileges()
  1031. bool revoke_privileges(1:PrivilegeBag privileges) throws(1:MetaException o1)
  1032. GrantRevokePrivilegeResponse grant_revoke_privileges(1:GrantRevokePrivilegeRequest request) throws(1:MetaException o1);
  1033. // this is used by metastore client to send UGI information to metastore server immediately
  1034. // after setting up a connection.
  1035. list<string> set_ugi(1:string user_name, 2:list<string> group_names) throws (1:MetaException o1)
  1036. //Authentication (delegation token) interfaces
  1037. // get metastore server delegation token for use from the map/reduce tasks to authenticate
  1038. // to metastore server
  1039. string get_delegation_token(1:string token_owner, 2:string renewer_kerberos_principal_name)
  1040. throws (1:MetaException o1)
  1041. // method to renew delegation token obtained from metastore server
  1042. i64 renew_delegation_token(1:string token_str_form) throws (1:MetaException o1)
  1043. // method to cancel delegation token obtained from metastore server
  1044. void cancel_delegation_token(1:string token_str_form) throws (1:MetaException o1)
  1045. // Transaction and lock management calls
  1046. // Get just list of open transactions
  1047. GetOpenTxnsResponse get_open_txns()
  1048. // Get list of open transactions with state (open, aborted)
  1049. GetOpenTxnsInfoResponse get_open_txns_info()
  1050. OpenTxnsResponse open_txns(1:OpenTxnRequest rqst)
  1051. void abort_txn(1:AbortTxnRequest rqst) throws (1:NoSuchTxnException o1)
  1052. void commit_txn(1:CommitTxnRequest rqst) throws (1:NoSuchTxnException o1, 2:TxnAbortedException o2)
  1053. LockResponse lock(1:LockRequest rqst) throws (1:NoSuchTxnException o1, 2:TxnAbortedException o2)
  1054. LockResponse check_lock(1:CheckLockRequest rqst)
  1055. throws (1:NoSuchTxnException o1, 2:TxnAbortedException o2, 3:NoSuchLockException o3)
  1056. void unlock(1:UnlockRequest rqst) throws (1:NoSuchLockException o1, 2:TxnOpenException o2)
  1057. ShowLocksResponse show_locks(1:ShowLocksRequest rqst)
  1058. void heartbeat(1:HeartbeatRequest ids) throws (1:NoSuchLockException o1, 2:NoSuchTxnException o2, 3:TxnAbortedException o3)
  1059. HeartbeatTxnRangeResponse heartbeat_txn_range(1:HeartbeatTxnRangeRequest txns)
  1060. void compact(1:CompactionRequest rqst)
  1061. ShowCompactResponse show_compact(1:ShowCompactRequest rqst)
  1062. void add_dynamic_partitions(1:AddDynamicPartitions rqst) throws (1:NoSuchTxnException o1, 2:TxnAbortedException o2)
  1063. // Notification logging calls
  1064. NotificationEventResponse get_next_notification(1:NotificationEventRequest rqst)
  1065. CurrentNotificationEventId get_current_notificationEventId()
  1066. FireEventResponse fire_listener_event(1:FireEventRequest rqst)
  1067. void flushCache()
  1068. GetFileMetadataByExprResult get_file_metadata_by_expr(1:GetFileMetadataByExprRequest req)
  1069. GetFileMetadataResult get_file_metadata(1:GetFileMetadataRequest req)
  1070. PutFileMetadataResult put_file_metadata(1:PutFileMetadataRequest req)
  1071. ClearFileMetadataResult clear_file_metadata(1:ClearFileMetadataRequest req)
  1072. }
  1073. // * Note about the DDL_TIME: When creating or altering a table or a partition,
  1074. // if the DDL_TIME is not set, the current time will be used.
  1075. // For storing info about archived partitions in parameters
  1076. // Whether the partition is archived
  1077. const string IS_ARCHIVED = "is_archived",
  1078. // The original location of the partition, before archiving. After archiving,
  1079. // this directory will contain the archive. When the partition
  1080. // is dropped, this directory will be deleted
  1081. const string ORIGINAL_LOCATION = "original_location",
  1082. // Whether or not the table is considered immutable - immutable tables can only be
  1083. // overwritten or created if unpartitioned, or if partitioned, partitions inside them
  1084. // can only be overwritten or created. Immutability supports write-once and replace
  1085. // semantics, but not append.
  1086. const string IS_IMMUTABLE = "immutable",
  1087. // these should be needed only for backward compatibility with filestore
  1088. const string META_TABLE_COLUMNS = "columns",
  1089. const string META_TABLE_COLUMN_TYPES = "columns.types",
  1090. const string BUCKET_FIELD_NAME = "bucket_field_name",
  1091. const string BUCKET_COUNT = "bucket_count",
  1092. const string FIELD_TO_DIMENSION = "field_to_dimension",
  1093. const string META_TABLE_NAME = "name",
  1094. const string META_TABLE_DB = "db",
  1095. const string META_TABLE_LOCATION = "location",
  1096. const string META_TABLE_SERDE = "serde",
  1097. const string META_TABLE_PARTITION_COLUMNS = "partition_columns",
  1098. const string META_TABLE_PARTITION_COLUMN_TYPES = "partition_columns.types",
  1099. const string FILE_INPUT_FORMAT = "file.inputformat",
  1100. const string FILE_OUTPUT_FORMAT = "file.outputformat",
  1101. const string META_TABLE_STORAGE = "storage_handler",
  1102. const string TABLE_IS_TRANSACTIONAL = "transactional",
  1103. const string TABLE_NO_AUTO_COMPACT = "no_auto_compaction",