Class GlueHiveMetastore
java.lang.Object
io.trino.plugin.hive.metastore.glue.GlueHiveMetastore
- All Implemented Interfaces:
HiveMetastore
-
Constructor Summary
ConstructorsConstructorDescriptionGlueHiveMetastore(TrinoFileSystemFactory fileSystemFactory, GlueHiveMetastoreConfig glueConfig, Executor partitionsReadExecutor, GlueColumnStatisticsProviderFactory columnStatisticsProviderFactory, com.amazonaws.services.glue.AWSGlueAsync glueClient, GlueMetastoreStats stats, Predicate<com.amazonaws.services.glue.model.Table> tableFilter) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddColumn(String databaseName, String tableName, String columnName, HiveType columnType, String columnComment) voidaddPartitions(String databaseName, String tableName, List<PartitionWithStatistics> partitions) voidalterPartition(String databaseName, String tableName, PartitionWithStatistics partition) voidvoidvoidcommentTable(String databaseName, String tableName, Optional<String> comment) voidcreateDatabase(Database database) voidcreateRole(String role, String grantor) voidcreateTable(Table table, PrincipalPrivileges principalPrivileges) static GlueHiveMetastorecreateTestingGlueHiveMetastore(Path defaultWarehouseDir) voiddropColumn(String databaseName, String tableName, String columnName) voiddropDatabase(String databaseName, boolean deleteData) voiddropPartition(String databaseName, String tableName, List<String> parts, boolean deleteData) voidvoidgetAllTables(String databaseName) getAllViews(String databaseName) Lists views and materialized views from given database.getDatabase(String databaseName) getPartition(Table table, List<String> partitionValues) 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).getPartitionsByNames(Table table, List<String> partitionNames) Ex: Partition keys = ['a', 'b'] Partition names = ['a=1/b=2', 'a=2/b=2']getPartitionStatistics(Table table, List<Partition> partitions) getStats()getTableStatistics(Table table) getTablesWithParameter(String databaseName, String parameterKey, String parameterValue) 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) listGrantedPrincipals(String role) listRoleGrants(HivePrincipal principal) listTablePrivileges(String databaseName, String tableName, Optional<String> tableOwner, Optional<HivePrincipal> principal) 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) 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) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.trino.plugin.hive.metastore.HiveMetastore
abortTransaction, acquireSharedReadLock, acquireTableWriteLock, addDynamicPartitions, allocateWriteId, alterPartitions, alterTransactionalTable, commitTransaction, getConfigValue, getValidWriteIds, openTransaction, sendTransactionHeartbeat, updatePartitionStatistics, updateTableWriteId
-
Constructor Details
-
GlueHiveMetastore
@Inject public GlueHiveMetastore(TrinoFileSystemFactory fileSystemFactory, GlueHiveMetastoreConfig glueConfig, Executor partitionsReadExecutor, GlueColumnStatisticsProviderFactory columnStatisticsProviderFactory, com.amazonaws.services.glue.AWSGlueAsync glueClient, GlueMetastoreStats stats, Predicate<com.amazonaws.services.glue.model.Table> tableFilter)
-
-
Method Details
-
createTestingGlueHiveMetastore
-
getStats
-
getDatabase
- Specified by:
getDatabasein interfaceHiveMetastore
-
getAllDatabases
- Specified by:
getAllDatabasesin interfaceHiveMetastore
-
getTable
- Specified by:
getTablein interfaceHiveMetastore
-
getSupportedColumnStatistics
- Specified by:
getSupportedColumnStatisticsin interfaceHiveMetastore
-
getTableStatistics
- 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
- Specified by:
getAllTablesin interfaceHiveMetastore
-
getAllTables
- Specified by:
getAllTablesin interfaceHiveMetastore- Returns:
- List of tables, views and materialized views names from all schemas or Optional.empty if operation is not supported
-
getTablesWithParameter
public List<String> getTablesWithParameter(String databaseName, String parameterKey, String parameterValue) - Specified by:
getTablesWithParameterin interfaceHiveMetastore
-
getAllViews
Description copied from interface:HiveMetastoreLists views and materialized views from given database.- Specified by:
getAllViewsin interfaceHiveMetastore
-
getAllViews
- Specified by:
getAllViewsin interfaceHiveMetastore- Returns:
- List of views including materialized views names from all schemas or Optional.empty if operation is not supported
-
createDatabase
- Specified by:
createDatabasein interfaceHiveMetastore
-
dropDatabase
- Specified by:
dropDatabasein interfaceHiveMetastore
-
renameDatabase
- Specified by:
renameDatabasein interfaceHiveMetastore
-
setDatabaseOwner
- Specified by:
setDatabaseOwnerin interfaceHiveMetastore
-
createTable
- Specified by:
createTablein interfaceHiveMetastore
-
dropTable
- 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
- Specified by:
commentTablein interfaceHiveMetastore
-
setTableOwner
- 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
- Specified by:
dropColumnin interfaceHiveMetastore
-
getPartition
- 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:
-
getPartitionsByNames
public Map<String,Optional<Partition>> getPartitionsByNames(Table table, List<String> partitionNames) Ex: Partition keys = ['a', 'b'] Partition names = ['a=1/b=2', 'a=2/b=2']- Specified by:
getPartitionsByNamesin interfaceHiveMetastore- Parameters:
partitionNames- List of full partition names- Returns:
- Mapping of partition name to partition object
-
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
- Specified by:
createRolein interfaceHiveMetastore
-
dropRole
- Specified by:
dropRolein interfaceHiveMetastore
-
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
- Specified by:
listGrantedPrincipalsin interfaceHiveMetastore
-
listRoleGrants
- 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
-
checkSupportsTransactions
public void checkSupportsTransactions()- Specified by:
checkSupportsTransactionsin interfaceHiveMetastore
-