Class AlluxioHiveMetastore
- java.lang.Object
-
- io.trino.plugin.hive.metastore.alluxio.AlluxioHiveMetastore
-
- All Implemented Interfaces:
HiveMetastore
public class AlluxioHiveMetastore extends Object implements HiveMetastore
Implementation of theHiveMetastoreinterface through Alluxio.
-
-
Constructor Summary
Constructors Constructor Description AlluxioHiveMetastore(alluxio.client.table.TableMasterClient client, HiveMetastoreConfig hiveMetastoreConfig)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddColumn(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)voidcommentColumn(String databaseName, String tableName, String columnName, Optional<String> comment)voidcommentTable(String databaseName, String tableName, Optional<String> comment)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<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)voidgrantRoles(Set<String> roles, Set<HivePrincipal> grantees, boolean withAdminOption, 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)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 adminOptionFor, 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, wait
-
Methods inherited from interface io.trino.plugin.hive.metastore.HiveMetastore
abortTransaction, acquireSharedReadLock, acquireTableWriteLock, addDynamicPartitions, allocateWriteId, alterPartitions, alterTransactionalTable, commitTransaction, getConfigValue, getValidWriteIds, openTransaction, sendTransactionHeartbeat, updatePartitionStatistics, updateTableWriteId
-
-
-
-
Constructor Detail
-
AlluxioHiveMetastore
public AlluxioHiveMetastore(alluxio.client.table.TableMasterClient client, HiveMetastoreConfig hiveMetastoreConfig)
-
-
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 withAdminOption, HivePrincipal grantor)
- Specified by:
grantRolesin interfaceHiveMetastore
-
revokeRoles
public void revokeRoles(Set<String> roles, Set<HivePrincipal> grantees, boolean adminOptionFor, 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
-
-