Class BridgingHiveMetastore
- java.lang.Object
-
- io.trino.plugin.hive.metastore.thrift.BridgingHiveMetastore
-
- All Implemented Interfaces:
HiveMetastore
public class BridgingHiveMetastore extends Object implements HiveMetastore
-
-
Constructor Summary
Constructors Constructor Description BridgingHiveMetastore(ThriftMetastore delegate)
-
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)voidacquireTableWriteLock(AcidTransactionOwner transactionOwner, String queryId, long transactionId, String dbName, String tableName, org.apache.hadoop.hive.metastore.api.DataOperationType operation, boolean isDynamicPartitionWrite)voidaddColumn(String databaseName, String tableName, String columnName, HiveType columnType, String columnComment)voidaddDynamicPartitions(String dbName, String tableName, List<String> partitionNames, long transactionId, long writeId, AcidOperation operation)voidaddPartitions(String databaseName, String tableName, List<PartitionWithStatistics> partitions)longallocateWriteId(String dbName, String tableName, long transactionId)voidalterPartition(String databaseName, String tableName, PartitionWithStatistics partition)voidalterPartitions(String dbName, String tableName, List<Partition> partitions, long writeId)voidalterTransactionalTable(Table table, long transactionId, long writeId, PrincipalPrivileges principalPrivileges)voidcommentColumn(String databaseName, String tableName, String columnName, Optional<String> comment)voidcommentTable(String databaseName, String tableName, Optional<String> comment)voidcommitTransaction(long transactionId)voidcreateDatabase(Database database)voidcreateRole(String role, String grantor)voidcreateTable(Table table, PrincipalPrivileges principalPrivileges)voiddropColumn(String databaseName, String tableName, String columnName)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<Database>getDatabase(String databaseName)Optional<Partition>getPartition(Table table, List<String> partitionValues)Optional<List<String>>getPartitionNamesByFilter(String databaseName, String tableName, List<String> columnNames, TupleDomain<String> partitionKeysFilter)Return a list of partition names, with optional filtering (hint to improve performance if possible).Map<String,Optional<Partition>>getPartitionsByNames(Table table, List<String> partitionNames)Map<String,PartitionStatistics>getPartitionStatistics(Table table, List<Partition> partitions)Set<ColumnStatisticType>getSupportedColumnStatistics(Type type)Optional<Table>getTable(String databaseName, String tableName)PartitionStatisticsgetTableStatistics(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)voidrenameColumn(String databaseName, String tableName, String oldColumnName, String newColumnName)voidrenameDatabase(String databaseName, String newDatabaseName)voidrenameTable(String databaseName, String tableName, String newDatabaseName, String newTableName)voidreplaceTable(String databaseName, String tableName, Table newTable, PrincipalPrivileges principalPrivileges)This should only be used if the semantic here is drop and add.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)voidsetDatabaseOwner(String databaseName, HivePrincipal principal)voidsetTableOwner(String databaseName, String tableName, HivePrincipal principal)voidupdatePartitionStatistics(Table table, Map<String,Function<PartitionStatistics,PartitionStatistics>> updates)voidupdateTableStatistics(String databaseName, String tableName, AcidTransaction transaction, Function<PartitionStatistics,PartitionStatistics> update)voidupdateTableWriteId(String dbName, String tableName, long transactionId, long writeId, OptionalLong rowCountChange)-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface io.trino.plugin.hive.metastore.HiveMetastore
updatePartitionStatistics
-
-
-
-
Constructor Detail
-
BridgingHiveMetastore
public BridgingHiveMetastore(ThriftMetastore delegate)
-
-
Method Detail
-
getDatabase
public Optional<Database> getDatabase(String databaseName)
- Specified by:
getDatabasein interfaceHiveMetastore
-
getAllDatabases
public List<String> getAllDatabases()
- Specified by:
getAllDatabasesin interfaceHiveMetastore
-
getTable
public Optional<Table> getTable(String databaseName, String tableName)
- Specified by:
getTablein interfaceHiveMetastore
-
getSupportedColumnStatistics
public Set<ColumnStatisticType> getSupportedColumnStatistics(Type type)
- Specified by:
getSupportedColumnStatisticsin interfaceHiveMetastore
-
getTableStatistics
public PartitionStatistics getTableStatistics(Table table)
- Specified by:
getTableStatisticsin interfaceHiveMetastore
-
getPartitionStatistics
public Map<String,PartitionStatistics> getPartitionStatistics(Table table, List<Partition> partitions)
- Specified by:
getPartitionStatisticsin interfaceHiveMetastore
-
updateTableStatistics
public void updateTableStatistics(String databaseName, String tableName, AcidTransaction transaction, Function<PartitionStatistics,PartitionStatistics> update)
- Specified by:
updateTableStatisticsin interfaceHiveMetastore
-
updatePartitionStatistics
public void updatePartitionStatistics(Table table, Map<String,Function<PartitionStatistics,PartitionStatistics>> updates)
- Specified by:
updatePartitionStatisticsin interfaceHiveMetastore
-
getAllTables
public List<String> getAllTables(String databaseName)
- Specified by:
getAllTablesin interfaceHiveMetastore
-
getTablesWithParameter
public List<String> getTablesWithParameter(String databaseName, String parameterKey, String parameterValue)
- Specified by:
getTablesWithParameterin interfaceHiveMetastore
-
getAllViews
public List<String> getAllViews(String databaseName)
- Specified by:
getAllViewsin interfaceHiveMetastore
-
createDatabase
public void createDatabase(Database database)
- Specified by:
createDatabasein interfaceHiveMetastore
-
dropDatabase
public void dropDatabase(String databaseName, boolean deleteData)
- Specified by:
dropDatabasein interfaceHiveMetastore
-
renameDatabase
public void renameDatabase(String databaseName, String newDatabaseName)
- Specified by:
renameDatabasein interfaceHiveMetastore
-
setDatabaseOwner
public void setDatabaseOwner(String databaseName, HivePrincipal principal)
- Specified by:
setDatabaseOwnerin interfaceHiveMetastore
-
createTable
public void createTable(Table table, PrincipalPrivileges principalPrivileges)
- Specified by:
createTablein interfaceHiveMetastore
-
dropTable
public void dropTable(String databaseName, String tableName, boolean deleteData)
- Specified by:
dropTablein interfaceHiveMetastore
-
replaceTable
public void replaceTable(String databaseName, String tableName, Table newTable, PrincipalPrivileges principalPrivileges)
Description copied from interface:HiveMetastoreThis should only be used if the semantic here is drop and add. Trying to alter one field of a table object previously acquired from getTable is probably not what you want.- Specified by:
replaceTablein interfaceHiveMetastore
-
renameTable
public void renameTable(String databaseName, String tableName, String newDatabaseName, String newTableName)
- Specified by:
renameTablein interfaceHiveMetastore
-
commentTable
public void commentTable(String databaseName, String tableName, Optional<String> comment)
- Specified by:
commentTablein interfaceHiveMetastore
-
setTableOwner
public void setTableOwner(String databaseName, String tableName, HivePrincipal principal)
- Specified by:
setTableOwnerin interfaceHiveMetastore
-
commentColumn
public void commentColumn(String databaseName, String tableName, String columnName, Optional<String> comment)
- Specified by:
commentColumnin interfaceHiveMetastore
-
addColumn
public void addColumn(String databaseName, String tableName, String columnName, HiveType columnType, String columnComment)
- Specified by:
addColumnin interfaceHiveMetastore
-
renameColumn
public void renameColumn(String databaseName, String tableName, String oldColumnName, String newColumnName)
- Specified by:
renameColumnin interfaceHiveMetastore
-
dropColumn
public void dropColumn(String databaseName, String tableName, String columnName)
- Specified by:
dropColumnin interfaceHiveMetastore
-
getPartition
public Optional<Partition> getPartition(Table table, List<String> partitionValues)
- Specified by:
getPartitionin interfaceHiveMetastore
-
getPartitionNamesByFilter
public Optional<List<String>> getPartitionNamesByFilter(String databaseName, String tableName, List<String> columnNames, TupleDomain<String> partitionKeysFilter)
Description copied from interface:HiveMetastoreReturn a list of partition names, with optional filtering (hint to improve performance if possible).- Specified by:
getPartitionNamesByFilterin interfaceHiveMetastore- Parameters:
databaseName- the name of the databasetableName- the name of the tablecolumnNames- the list of partition column namespartitionKeysFilter- optional filter for the partition column values- Returns:
- a list of partition names as created by
MetastoreUtil.toPartitionName(java.util.List<java.lang.String>, java.util.List<java.lang.String>) - See Also:
TupleDomain
-
getPartitionsByNames
public Map<String,Optional<Partition>> getPartitionsByNames(Table table, List<String> partitionNames)
- Specified by:
getPartitionsByNamesin interfaceHiveMetastore
-
addPartitions
public void addPartitions(String databaseName, String tableName, List<PartitionWithStatistics> partitions)
- Specified by:
addPartitionsin interfaceHiveMetastore
-
dropPartition
public void dropPartition(String databaseName, String tableName, List<String> parts, boolean deleteData)
- Specified by:
dropPartitionin interfaceHiveMetastore
-
alterPartition
public void alterPartition(String databaseName, String tableName, PartitionWithStatistics partition)
- Specified by:
alterPartitionin interfaceHiveMetastore
-
createRole
public void createRole(String role, String grantor)
- Specified by:
createRolein interfaceHiveMetastore
-
dropRole
public void dropRole(String role)
- Specified by:
dropRolein interfaceHiveMetastore
-
listRoles
public Set<String> listRoles()
- Specified by:
listRolesin interfaceHiveMetastore
-
grantRoles
public void grantRoles(Set<String> roles, Set<HivePrincipal> grantees, boolean adminOption, HivePrincipal grantor)
- Specified by:
grantRolesin interfaceHiveMetastore
-
revokeRoles
public void revokeRoles(Set<String> roles, Set<HivePrincipal> grantees, boolean adminOption, HivePrincipal grantor)
- Specified by:
revokeRolesin interfaceHiveMetastore
-
listGrantedPrincipals
public Set<RoleGrant> listGrantedPrincipals(String role)
- Specified by:
listGrantedPrincipalsin interfaceHiveMetastore
-
listRoleGrants
public Set<RoleGrant> listRoleGrants(HivePrincipal principal)
- Specified by:
listRoleGrantsin interfaceHiveMetastore
-
grantTablePrivileges
public void grantTablePrivileges(String databaseName, String tableName, String tableOwner, HivePrincipal grantee, HivePrincipal grantor, Set<HivePrivilegeInfo.HivePrivilege> privileges, boolean grantOption)
- Specified by:
grantTablePrivilegesin interfaceHiveMetastore
-
revokeTablePrivileges
public void revokeTablePrivileges(String databaseName, String tableName, String tableOwner, HivePrincipal grantee, HivePrincipal grantor, Set<HivePrivilegeInfo.HivePrivilege> privileges, boolean grantOption)
- Specified by:
revokeTablePrivilegesin interfaceHiveMetastore
-
listTablePrivileges
public Set<HivePrivilegeInfo> listTablePrivileges(String databaseName, String tableName, Optional<String> tableOwner, Optional<HivePrincipal> principal)
- Specified by:
listTablePrivilegesin interfaceHiveMetastoreprincipal- when empty, all table privileges are returned
-
getConfigValue
public Optional<String> getConfigValue(String name)
- Specified by:
getConfigValuein interfaceHiveMetastore
-
openTransaction
public long openTransaction(AcidTransactionOwner transactionOwner)
- Specified by:
openTransactionin interfaceHiveMetastore
-
commitTransaction
public void commitTransaction(long transactionId)
- Specified by:
commitTransactionin interfaceHiveMetastore
-
abortTransaction
public void abortTransaction(long transactionId)
- Specified by:
abortTransactionin interfaceHiveMetastore
-
sendTransactionHeartbeat
public void sendTransactionHeartbeat(long transactionId)
- Specified by:
sendTransactionHeartbeatin interfaceHiveMetastore
-
acquireSharedReadLock
public void acquireSharedReadLock(AcidTransactionOwner transactionOwner, String queryId, long transactionId, List<SchemaTableName> fullTables, List<HivePartition> partitions)
- Specified by:
acquireSharedReadLockin interfaceHiveMetastore
-
getValidWriteIds
public String getValidWriteIds(List<SchemaTableName> tables, long currentTransactionId)
- Specified by:
getValidWriteIdsin interfaceHiveMetastore
-
allocateWriteId
public long allocateWriteId(String dbName, String tableName, long transactionId)
- Specified by:
allocateWriteIdin interfaceHiveMetastore
-
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 interfaceHiveMetastore
-
updateTableWriteId
public void updateTableWriteId(String dbName, String tableName, long transactionId, long writeId, OptionalLong rowCountChange)
- Specified by:
updateTableWriteIdin interfaceHiveMetastore
-
alterPartitions
public void alterPartitions(String dbName, String tableName, List<Partition> partitions, long writeId)
- Specified by:
alterPartitionsin interfaceHiveMetastore
-
addDynamicPartitions
public void addDynamicPartitions(String dbName, String tableName, List<String> partitionNames, long transactionId, long writeId, AcidOperation operation)
- Specified by:
addDynamicPartitionsin interfaceHiveMetastore
-
alterTransactionalTable
public void alterTransactionalTable(Table table, long transactionId, long writeId, PrincipalPrivileges principalPrivileges)
- Specified by:
alterTransactionalTablein interfaceHiveMetastore
-
-