Class ThriftHiveMetastore
- java.lang.Object
-
- io.trino.plugin.hive.metastore.thrift.ThriftHiveMetastore
-
- All Implemented Interfaces:
ThriftMetastore
@ThreadSafe public class ThriftHiveMetastore extends Object implements ThriftMetastore
-
-
Constructor Summary
Constructors Constructor Description ThriftHiveMetastore(Optional<ConnectorIdentity> identity, HdfsEnvironment hdfsEnvironment, TokenDelegationThriftMetastoreFactory metastoreFactory, double backoffScaleFactor, io.airlift.units.Duration minBackoffDelay, io.airlift.units.Duration maxBackoffDelay, io.airlift.units.Duration maxRetryTime, io.airlift.units.Duration maxWaitForLock, int maxRetries, boolean deleteFilesOnDrop, boolean translateHiveViews, boolean assumeCanonicalPartitionKeys, ThriftMetastoreStats stats)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidabortTransaction(long transactionId)voidacquireSharedReadLock(AcidTransactionOwner transactionOwner, String queryId, long transactionId, List<SchemaTableName> fullTables, List<HivePartition> partitions)longacquireTableExclusiveLock(AcidTransactionOwner transactionOwner, String queryId, String dbName, String tableName)voidacquireTableWriteLock(AcidTransactionOwner transactionOwner, String queryId, long transactionId, String dbName, String tableName, org.apache.hadoop.hive.metastore.api.DataOperationType operation, boolean isDynamicPartitionWrite)voidaddDynamicPartitions(String dbName, String tableName, List<String> partitionNames, long transactionId, long writeId, AcidOperation operation)voidaddPartitions(String databaseName, String tableName, List<PartitionWithStatistics> partitionsWithStatistics)longallocateWriteId(String dbName, String tableName, long transactionId)voidalterDatabase(String databaseName, org.apache.hadoop.hive.metastore.api.Database database)voidalterPartition(String databaseName, String tableName, PartitionWithStatistics partitionWithStatistics)voidalterPartitions(String dbName, String tableName, List<org.apache.hadoop.hive.metastore.api.Partition> partitions, long writeId)voidalterTable(String databaseName, String tableName, org.apache.hadoop.hive.metastore.api.Table table)voidalterTransactionalTable(org.apache.hadoop.hive.metastore.api.Table table, long transactionId, long writeId)voidcommitTransaction(long transactionId)voidcreateDatabase(org.apache.hadoop.hive.metastore.api.Database database)voidcreateRole(String role, String grantor)voidcreateTable(org.apache.hadoop.hive.metastore.api.Table table)voiddropDatabase(String databaseName, boolean deleteData)voiddropPartition(String databaseName, String tableName, List<String> parts, boolean deleteData)voiddropRole(String role)voiddropTable(String databaseName, String tableName, boolean deleteData)List<String>getAllDatabases()List<String>getAllTables(String databaseName)List<String>getAllViews(String databaseName)Optional<String>getConfigValue(String name)Optional<org.apache.hadoop.hive.metastore.api.Database>getDatabase(String databaseName)Optional<List<org.apache.hadoop.hive.metastore.api.FieldSchema>>getFields(String databaseName, String tableName)Optional<org.apache.hadoop.hive.metastore.api.Partition>getPartition(String databaseName, String tableName, List<String> partitionValues)Optional<List<String>>getPartitionNamesByFilter(String databaseName, String tableName, List<String> columnNames, TupleDomain<String> partitionKeysFilter)List<org.apache.hadoop.hive.metastore.api.Partition>getPartitionsByNames(String databaseName, String tableName, List<String> partitionNames)Map<String,PartitionStatistics>getPartitionStatistics(org.apache.hadoop.hive.metastore.api.Table table, List<org.apache.hadoop.hive.metastore.api.Partition> partitions)ThriftMetastoreStatsgetStats()Set<ColumnStatisticType>getSupportedColumnStatistics(Type type)Optional<org.apache.hadoop.hive.metastore.api.Table>getTable(String databaseName, String tableName)PartitionStatisticsgetTableStatistics(org.apache.hadoop.hive.metastore.api.Table table)List<String>getTablesWithParameter(String databaseName, String parameterKey, String parameterValue)StringgetValidWriteIds(List<SchemaTableName> tables, long currentTransactionId)voidgrantRoles(Set<String> roles, Set<HivePrincipal> grantees, boolean adminOption, HivePrincipal grantor)voidgrantTablePrivileges(String databaseName, String tableName, String tableOwner, HivePrincipal grantee, HivePrincipal grantor, Set<HivePrivilegeInfo.HivePrivilege> privileges, boolean grantOption)Set<RoleGrant>listGrantedPrincipals(String role)Set<RoleGrant>listRoleGrants(HivePrincipal principal)Set<String>listRoles()Set<HivePrivilegeInfo>listTablePrivileges(String databaseName, String tableName, Optional<String> tableOwner, Optional<HivePrincipal> principal)longopenTransaction(AcidTransactionOwner transactionOwner)voidreleaseTableLock(long lockId)voidrevokeRoles(Set<String> roles, Set<HivePrincipal> grantees, boolean adminOption, HivePrincipal grantor)voidrevokeTablePrivileges(String databaseName, String tableName, String tableOwner, HivePrincipal grantee, HivePrincipal grantor, Set<HivePrivilegeInfo.HivePrivilege> privileges, boolean grantOption)voidsendTransactionHeartbeat(long transactionId)voidupdatePartitionStatistics(org.apache.hadoop.hive.metastore.api.Table table, String partitionName, Function<PartitionStatistics,PartitionStatistics> update)voidupdateTableStatistics(String databaseName, String tableName, AcidTransaction transaction, Function<PartitionStatistics,PartitionStatistics> update)voidupdateTableWriteId(String dbName, String tableName, long transactionId, long writeId, OptionalLong rowCountChange)
-
-
-
Constructor Detail
-
ThriftHiveMetastore
public ThriftHiveMetastore(Optional<ConnectorIdentity> identity, HdfsEnvironment hdfsEnvironment, TokenDelegationThriftMetastoreFactory metastoreFactory, double backoffScaleFactor, io.airlift.units.Duration minBackoffDelay, io.airlift.units.Duration maxBackoffDelay, io.airlift.units.Duration maxRetryTime, io.airlift.units.Duration maxWaitForLock, int maxRetries, boolean deleteFilesOnDrop, boolean translateHiveViews, boolean assumeCanonicalPartitionKeys, ThriftMetastoreStats stats)
-
-
Method Detail
-
getStats
public ThriftMetastoreStats getStats()
-
getAllDatabases
public List<String> getAllDatabases()
- Specified by:
getAllDatabasesin interfaceThriftMetastore
-
getDatabase
public Optional<org.apache.hadoop.hive.metastore.api.Database> getDatabase(String databaseName)
- Specified by:
getDatabasein interfaceThriftMetastore
-
getAllTables
public List<String> getAllTables(String databaseName)
- Specified by:
getAllTablesin interfaceThriftMetastore
-
getTablesWithParameter
public List<String> getTablesWithParameter(String databaseName, String parameterKey, String parameterValue)
- Specified by:
getTablesWithParameterin interfaceThriftMetastore
-
getTable
public Optional<org.apache.hadoop.hive.metastore.api.Table> getTable(String databaseName, String tableName)
- Specified by:
getTablein interfaceThriftMetastore
-
getSupportedColumnStatistics
public Set<ColumnStatisticType> getSupportedColumnStatistics(Type type)
- Specified by:
getSupportedColumnStatisticsin interfaceThriftMetastore
-
getTableStatistics
public PartitionStatistics getTableStatistics(org.apache.hadoop.hive.metastore.api.Table table)
- Specified by:
getTableStatisticsin interfaceThriftMetastore
-
getPartitionStatistics
public Map<String,PartitionStatistics> getPartitionStatistics(org.apache.hadoop.hive.metastore.api.Table table, List<org.apache.hadoop.hive.metastore.api.Partition> partitions)
- Specified by:
getPartitionStatisticsin interfaceThriftMetastore
-
getFields
public Optional<List<org.apache.hadoop.hive.metastore.api.FieldSchema>> getFields(String databaseName, String tableName)
- Specified by:
getFieldsin interfaceThriftMetastore
-
updateTableStatistics
public void updateTableStatistics(String databaseName, String tableName, AcidTransaction transaction, Function<PartitionStatistics,PartitionStatistics> update)
- Specified by:
updateTableStatisticsin interfaceThriftMetastore
-
updatePartitionStatistics
public void updatePartitionStatistics(org.apache.hadoop.hive.metastore.api.Table table, String partitionName, Function<PartitionStatistics,PartitionStatistics> update)- Specified by:
updatePartitionStatisticsin interfaceThriftMetastore
-
createRole
public void createRole(String role, String grantor)
- Specified by:
createRolein interfaceThriftMetastore
-
dropRole
public void dropRole(String role)
- Specified by:
dropRolein interfaceThriftMetastore
-
listRoles
public Set<String> listRoles()
- Specified by:
listRolesin interfaceThriftMetastore
-
grantRoles
public void grantRoles(Set<String> roles, Set<HivePrincipal> grantees, boolean adminOption, HivePrincipal grantor)
- Specified by:
grantRolesin interfaceThriftMetastore
-
revokeRoles
public void revokeRoles(Set<String> roles, Set<HivePrincipal> grantees, boolean adminOption, HivePrincipal grantor)
- Specified by:
revokeRolesin interfaceThriftMetastore
-
listGrantedPrincipals
public Set<RoleGrant> listGrantedPrincipals(String role)
- Specified by:
listGrantedPrincipalsin interfaceThriftMetastore
-
listRoleGrants
public Set<RoleGrant> listRoleGrants(HivePrincipal principal)
- Specified by:
listRoleGrantsin interfaceThriftMetastore
-
getAllViews
public List<String> getAllViews(String databaseName)
- Specified by:
getAllViewsin interfaceThriftMetastore
-
createDatabase
public void createDatabase(org.apache.hadoop.hive.metastore.api.Database database)
- Specified by:
createDatabasein interfaceThriftMetastore
-
dropDatabase
public void dropDatabase(String databaseName, boolean deleteData)
- Specified by:
dropDatabasein interfaceThriftMetastore
-
alterDatabase
public void alterDatabase(String databaseName, org.apache.hadoop.hive.metastore.api.Database database)
- Specified by:
alterDatabasein interfaceThriftMetastore
-
createTable
public void createTable(org.apache.hadoop.hive.metastore.api.Table table)
- Specified by:
createTablein interfaceThriftMetastore
-
dropTable
public void dropTable(String databaseName, String tableName, boolean deleteData)
- Specified by:
dropTablein interfaceThriftMetastore
-
alterTable
public void alterTable(String databaseName, String tableName, org.apache.hadoop.hive.metastore.api.Table table)
- Specified by:
alterTablein interfaceThriftMetastore
-
alterTransactionalTable
public void alterTransactionalTable(org.apache.hadoop.hive.metastore.api.Table table, long transactionId, long writeId)- Specified by:
alterTransactionalTablein interfaceThriftMetastore
-
getPartitionNamesByFilter
public Optional<List<String>> getPartitionNamesByFilter(String databaseName, String tableName, List<String> columnNames, TupleDomain<String> partitionKeysFilter)
- Specified by:
getPartitionNamesByFilterin interfaceThriftMetastore
-
addPartitions
public void addPartitions(String databaseName, String tableName, List<PartitionWithStatistics> partitionsWithStatistics)
- Specified by:
addPartitionsin interfaceThriftMetastore
-
dropPartition
public void dropPartition(String databaseName, String tableName, List<String> parts, boolean deleteData)
- Specified by:
dropPartitionin interfaceThriftMetastore
-
alterPartition
public void alterPartition(String databaseName, String tableName, PartitionWithStatistics partitionWithStatistics)
- Specified by:
alterPartitionin interfaceThriftMetastore
-
getPartition
public Optional<org.apache.hadoop.hive.metastore.api.Partition> getPartition(String databaseName, String tableName, List<String> partitionValues)
- Specified by:
getPartitionin interfaceThriftMetastore
-
getPartitionsByNames
public List<org.apache.hadoop.hive.metastore.api.Partition> getPartitionsByNames(String databaseName, String tableName, List<String> partitionNames)
- Specified by:
getPartitionsByNamesin interfaceThriftMetastore
-
grantTablePrivileges
public void grantTablePrivileges(String databaseName, String tableName, String tableOwner, HivePrincipal grantee, HivePrincipal grantor, Set<HivePrivilegeInfo.HivePrivilege> privileges, boolean grantOption)
- Specified by:
grantTablePrivilegesin interfaceThriftMetastore
-
revokeTablePrivileges
public void revokeTablePrivileges(String databaseName, String tableName, String tableOwner, HivePrincipal grantee, HivePrincipal grantor, Set<HivePrivilegeInfo.HivePrivilege> privileges, boolean grantOption)
- Specified by:
revokeTablePrivilegesin interfaceThriftMetastore
-
listTablePrivileges
public Set<HivePrivilegeInfo> listTablePrivileges(String databaseName, String tableName, Optional<String> tableOwner, Optional<HivePrincipal> principal)
- Specified by:
listTablePrivilegesin interfaceThriftMetastoreprincipal- when empty, all table privileges are returned
-
openTransaction
public long openTransaction(AcidTransactionOwner transactionOwner)
- Specified by:
openTransactionin interfaceThriftMetastore
-
commitTransaction
public void commitTransaction(long transactionId)
- Specified by:
commitTransactionin interfaceThriftMetastore
-
abortTransaction
public void abortTransaction(long transactionId)
- Specified by:
abortTransactionin interfaceThriftMetastore
-
sendTransactionHeartbeat
public void sendTransactionHeartbeat(long transactionId)
- Specified by:
sendTransactionHeartbeatin interfaceThriftMetastore
-
acquireSharedReadLock
public void acquireSharedReadLock(AcidTransactionOwner transactionOwner, String queryId, long transactionId, List<SchemaTableName> fullTables, List<HivePartition> partitions)
- Specified by:
acquireSharedReadLockin interfaceThriftMetastore
-
acquireTableWriteLock
public void acquireTableWriteLock(AcidTransactionOwner transactionOwner, String queryId, long transactionId, String dbName, String tableName, org.apache.hadoop.hive.metastore.api.DataOperationType operation, boolean isDynamicPartitionWrite)
- Specified by:
acquireTableWriteLockin interfaceThriftMetastore
-
acquireTableExclusiveLock
public long acquireTableExclusiveLock(AcidTransactionOwner transactionOwner, String queryId, String dbName, String tableName)
- Specified by:
acquireTableExclusiveLockin interfaceThriftMetastore
-
releaseTableLock
public void releaseTableLock(long lockId)
- Specified by:
releaseTableLockin interfaceThriftMetastore
-
getValidWriteIds
public String getValidWriteIds(List<SchemaTableName> tables, long currentTransactionId)
- Specified by:
getValidWriteIdsin interfaceThriftMetastore
-
getConfigValue
public Optional<String> getConfigValue(String name)
- Specified by:
getConfigValuein interfaceThriftMetastore
-
allocateWriteId
public long allocateWriteId(String dbName, String tableName, long transactionId)
- Specified by:
allocateWriteIdin interfaceThriftMetastore
-
updateTableWriteId
public void updateTableWriteId(String dbName, String tableName, long transactionId, long writeId, OptionalLong rowCountChange)
- Specified by:
updateTableWriteIdin interfaceThriftMetastore
-
alterPartitions
public void alterPartitions(String dbName, String tableName, List<org.apache.hadoop.hive.metastore.api.Partition> partitions, long writeId)
- Specified by:
alterPartitionsin interfaceThriftMetastore
-
addDynamicPartitions
public void addDynamicPartitions(String dbName, String tableName, List<String> partitionNames, long transactionId, long writeId, AcidOperation operation)
- Specified by:
addDynamicPartitionsin interfaceThriftMetastore
-
-