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(MetastoreLocator metastoreLocator, HiveConfig hiveConfig, MetastoreConfig metastoreConfig, ThriftMetastoreConfig thriftConfig, HdfsEnvironment hdfsEnvironment, boolean authenticationEnabled)ThriftHiveMetastore(MetastoreLocator metastoreLocator, HiveConfig hiveConfig, MetastoreConfig metastoreConfig, ThriftMetastoreConfig thriftConfig, ThriftMetastoreAuthenticationConfig authenticationConfig, HdfsEnvironment hdfsEnvironment)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidacquireSharedReadLock(HiveIdentity identity, String queryId, long transactionId, List<SchemaTableName> fullTables, List<HivePartition> partitions)voidacquireTableWriteLock(HiveIdentity identity, String queryId, long transactionId, String dbName, String tableName, org.apache.hadoop.hive.metastore.api.DataOperationType operation, boolean isDynamicPartitionWrite)voidaddDynamicPartitions(HiveIdentity identity, String dbName, String tableName, List<String> partitionNames, long transactionId, long writeId, AcidOperation operation)voidaddPartitions(HiveIdentity identity, String databaseName, String tableName, List<PartitionWithStatistics> partitionsWithStatistics)longallocateWriteId(HiveIdentity identity, String dbName, String tableName, long transactionId)voidalterDatabase(HiveIdentity identity, String databaseName, org.apache.hadoop.hive.metastore.api.Database database)voidalterPartition(HiveIdentity identity, String databaseName, String tableName, PartitionWithStatistics partitionWithStatistics)voidalterPartitions(HiveIdentity identity, String dbName, String tableName, List<org.apache.hadoop.hive.metastore.api.Partition> partitions, long writeId)voidalterTable(HiveIdentity identity, String databaseName, String tableName, org.apache.hadoop.hive.metastore.api.Table table)voidalterTransactionalTable(HiveIdentity identity, org.apache.hadoop.hive.metastore.api.Table table, long transactionId, long writeId)voidcommitTransaction(HiveIdentity identity, long transactionId)voidcreateDatabase(HiveIdentity identity, org.apache.hadoop.hive.metastore.api.Database database)voidcreateRole(String role, String grantor)voidcreateTable(HiveIdentity identity, org.apache.hadoop.hive.metastore.api.Table table)voiddropDatabase(HiveIdentity identity, String databaseName)voiddropPartition(HiveIdentity identity, String databaseName, String tableName, List<String> parts, boolean deleteData)voiddropRole(String role)voiddropTable(HiveIdentity identity, 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(HiveIdentity identity, String databaseName, String tableName)Optional<org.apache.hadoop.hive.metastore.api.Partition>getPartition(HiveIdentity identity, String databaseName, String tableName, List<String> partitionValues)Optional<List<String>>getPartitionNamesByFilter(HiveIdentity identity, String databaseName, String tableName, List<String> columnNames, TupleDomain<String> partitionKeysFilter)List<org.apache.hadoop.hive.metastore.api.Partition>getPartitionsByNames(HiveIdentity identity, String databaseName, String tableName, List<String> partitionNames)Map<String,PartitionStatistics>getPartitionStatistics(HiveIdentity identity, 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(HiveIdentity identity, String databaseName, String tableName)PartitionStatisticsgetTableStatistics(HiveIdentity identity, org.apache.hadoop.hive.metastore.api.Table table)List<String>getTablesWithParameter(String databaseName, String parameterKey, String parameterValue)StringgetValidWriteIds(HiveIdentity identity, 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, Set<HivePrivilegeInfo> privileges)booleanisImpersonationEnabled()Set<RoleGrant>listGrantedPrincipals(String role)Set<RoleGrant>listRoleGrants(HivePrincipal principal)Set<String>listRoles()Set<HivePrivilegeInfo>listTablePrivileges(String databaseName, String tableName, String tableOwner, Optional<HivePrincipal> principal)longopenTransaction(HiveIdentity identity)voidrevokeRoles(Set<String> roles, Set<HivePrincipal> grantees, boolean adminOption, HivePrincipal grantor)voidrevokeTablePrivileges(String databaseName, String tableName, String tableOwner, HivePrincipal grantee, Set<HivePrivilegeInfo> privileges)voidsendTransactionHeartbeat(HiveIdentity identity, long transactionId)voidupdatePartitionStatistics(HiveIdentity identity, org.apache.hadoop.hive.metastore.api.Table table, String partitionName, Function<PartitionStatistics,PartitionStatistics> update)voidupdateTableStatistics(HiveIdentity identity, String databaseName, String tableName, AcidTransaction transaction, Function<PartitionStatistics,PartitionStatistics> update)voidupdateTableWriteId(HiveIdentity identity, String dbName, String tableName, long transactionId, long writeId, OptionalLong rowCountChange)
-
-
-
Constructor Detail
-
ThriftHiveMetastore
@Inject public ThriftHiveMetastore(MetastoreLocator metastoreLocator, HiveConfig hiveConfig, MetastoreConfig metastoreConfig, ThriftMetastoreConfig thriftConfig, ThriftMetastoreAuthenticationConfig authenticationConfig, HdfsEnvironment hdfsEnvironment)
-
ThriftHiveMetastore
public ThriftHiveMetastore(MetastoreLocator metastoreLocator, HiveConfig hiveConfig, MetastoreConfig metastoreConfig, ThriftMetastoreConfig thriftConfig, HdfsEnvironment hdfsEnvironment, boolean authenticationEnabled)
-
-
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(HiveIdentity identity, String databaseName, String tableName)
- Specified by:
getTablein interfaceThriftMetastore
-
getSupportedColumnStatistics
public Set<ColumnStatisticType> getSupportedColumnStatistics(Type type)
- Specified by:
getSupportedColumnStatisticsin interfaceThriftMetastore
-
getTableStatistics
public PartitionStatistics getTableStatistics(HiveIdentity identity, org.apache.hadoop.hive.metastore.api.Table table)
- Specified by:
getTableStatisticsin interfaceThriftMetastore
-
getPartitionStatistics
public Map<String,PartitionStatistics> getPartitionStatistics(HiveIdentity identity, 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(HiveIdentity identity, String databaseName, String tableName)
- Specified by:
getFieldsin interfaceThriftMetastore
-
updateTableStatistics
public void updateTableStatistics(HiveIdentity identity, String databaseName, String tableName, AcidTransaction transaction, Function<PartitionStatistics,PartitionStatistics> update)
- Specified by:
updateTableStatisticsin interfaceThriftMetastore
-
updatePartitionStatistics
public void updatePartitionStatistics(HiveIdentity identity, 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(HiveIdentity identity, org.apache.hadoop.hive.metastore.api.Database database)
- Specified by:
createDatabasein interfaceThriftMetastore
-
dropDatabase
public void dropDatabase(HiveIdentity identity, String databaseName)
- Specified by:
dropDatabasein interfaceThriftMetastore
-
alterDatabase
public void alterDatabase(HiveIdentity identity, String databaseName, org.apache.hadoop.hive.metastore.api.Database database)
- Specified by:
alterDatabasein interfaceThriftMetastore
-
createTable
public void createTable(HiveIdentity identity, org.apache.hadoop.hive.metastore.api.Table table)
- Specified by:
createTablein interfaceThriftMetastore
-
dropTable
public void dropTable(HiveIdentity identity, String databaseName, String tableName, boolean deleteData)
- Specified by:
dropTablein interfaceThriftMetastore
-
alterTable
public void alterTable(HiveIdentity identity, String databaseName, String tableName, org.apache.hadoop.hive.metastore.api.Table table)
- Specified by:
alterTablein interfaceThriftMetastore
-
alterTransactionalTable
public void alterTransactionalTable(HiveIdentity identity, org.apache.hadoop.hive.metastore.api.Table table, long transactionId, long writeId)
- Specified by:
alterTransactionalTablein interfaceThriftMetastore
-
getPartitionNamesByFilter
public Optional<List<String>> getPartitionNamesByFilter(HiveIdentity identity, String databaseName, String tableName, List<String> columnNames, TupleDomain<String> partitionKeysFilter)
- Specified by:
getPartitionNamesByFilterin interfaceThriftMetastore
-
addPartitions
public void addPartitions(HiveIdentity identity, String databaseName, String tableName, List<PartitionWithStatistics> partitionsWithStatistics)
- Specified by:
addPartitionsin interfaceThriftMetastore
-
dropPartition
public void dropPartition(HiveIdentity identity, String databaseName, String tableName, List<String> parts, boolean deleteData)
- Specified by:
dropPartitionin interfaceThriftMetastore
-
alterPartition
public void alterPartition(HiveIdentity identity, String databaseName, String tableName, PartitionWithStatistics partitionWithStatistics)
- Specified by:
alterPartitionin interfaceThriftMetastore
-
getPartition
public Optional<org.apache.hadoop.hive.metastore.api.Partition> getPartition(HiveIdentity identity, String databaseName, String tableName, List<String> partitionValues)
- Specified by:
getPartitionin interfaceThriftMetastore
-
getPartitionsByNames
public List<org.apache.hadoop.hive.metastore.api.Partition> getPartitionsByNames(HiveIdentity identity, String databaseName, String tableName, List<String> partitionNames)
- Specified by:
getPartitionsByNamesin interfaceThriftMetastore
-
grantTablePrivileges
public void grantTablePrivileges(String databaseName, String tableName, String tableOwner, HivePrincipal grantee, Set<HivePrivilegeInfo> privileges)
- Specified by:
grantTablePrivilegesin interfaceThriftMetastore
-
revokeTablePrivileges
public void revokeTablePrivileges(String databaseName, String tableName, String tableOwner, HivePrincipal grantee, Set<HivePrivilegeInfo> privileges)
- Specified by:
revokeTablePrivilegesin interfaceThriftMetastore
-
listTablePrivileges
public Set<HivePrivilegeInfo> listTablePrivileges(String databaseName, String tableName, String tableOwner, Optional<HivePrincipal> principal)
- Specified by:
listTablePrivilegesin interfaceThriftMetastoreprincipal- when empty, all table privileges are returned
-
openTransaction
public long openTransaction(HiveIdentity identity)
- Specified by:
openTransactionin interfaceThriftMetastore
-
commitTransaction
public void commitTransaction(HiveIdentity identity, long transactionId)
- Specified by:
commitTransactionin interfaceThriftMetastore
-
sendTransactionHeartbeat
public void sendTransactionHeartbeat(HiveIdentity identity, long transactionId)
- Specified by:
sendTransactionHeartbeatin interfaceThriftMetastore
-
acquireSharedReadLock
public void acquireSharedReadLock(HiveIdentity identity, String queryId, long transactionId, List<SchemaTableName> fullTables, List<HivePartition> partitions)
- Specified by:
acquireSharedReadLockin interfaceThriftMetastore
-
acquireTableWriteLock
public void acquireTableWriteLock(HiveIdentity identity, String queryId, long transactionId, String dbName, String tableName, org.apache.hadoop.hive.metastore.api.DataOperationType operation, boolean isDynamicPartitionWrite)
- Specified by:
acquireTableWriteLockin interfaceThriftMetastore
-
getValidWriteIds
public String getValidWriteIds(HiveIdentity identity, List<SchemaTableName> tables, long currentTransactionId)
- Specified by:
getValidWriteIdsin interfaceThriftMetastore
-
getConfigValue
public Optional<String> getConfigValue(String name)
- Specified by:
getConfigValuein interfaceThriftMetastore
-
allocateWriteId
public long allocateWriteId(HiveIdentity identity, String dbName, String tableName, long transactionId)
- Specified by:
allocateWriteIdin interfaceThriftMetastore
-
updateTableWriteId
public void updateTableWriteId(HiveIdentity identity, String dbName, String tableName, long transactionId, long writeId, OptionalLong rowCountChange)
- Specified by:
updateTableWriteIdin interfaceThriftMetastore
-
alterPartitions
public void alterPartitions(HiveIdentity identity, String dbName, String tableName, List<org.apache.hadoop.hive.metastore.api.Partition> partitions, long writeId)
- Specified by:
alterPartitionsin interfaceThriftMetastore
-
addDynamicPartitions
public void addDynamicPartitions(HiveIdentity identity, String dbName, String tableName, List<String> partitionNames, long transactionId, long writeId, AcidOperation operation)
- Specified by:
addDynamicPartitionsin interfaceThriftMetastore
-
isImpersonationEnabled
public boolean isImpersonationEnabled()
- Specified by:
isImpersonationEnabledin interfaceThriftMetastore
-
-