public class HiveMetadata extends Object implements TransactionalMetadata
Modifier and Type | Field and Description |
---|---|
static String |
PRESTO_VERSION_NAME |
static String |
REFERENCED_MATERIALIZED_VIEWS |
static Set<String> |
RESERVED_ROLES |
static String |
TABLE_COMMENT |
Constructor and Description |
---|
HiveMetadata(SemiTransactionalHiveMetastore metastore,
HdfsEnvironment hdfsEnvironment,
HivePartitionManager partitionManager,
org.joda.time.DateTimeZone timeZone,
boolean allowCorruptWritesForTesting,
boolean writesToNonManagedTablesEnabled,
boolean createsOfNonManagedTablesEnabled,
int maxPartitionBatchSize,
TypeManager typeManager,
LocationService locationService,
StandardFunctionResolution functionResolution,
RowExpressionService rowExpressionService,
FilterStatsCalculatorService filterStatsCalculatorService,
TableParameterCodec tableParameterCodec,
com.facebook.airlift.json.JsonCodec<PartitionUpdate> partitionUpdateCodec,
com.facebook.airlift.json.smile.SmileCodec<PartitionUpdate> partitionUpdateSmileCodec,
TypeTranslator typeTranslator,
String prestoVersion,
HiveStatisticsProvider hiveStatisticsProvider,
StagingFileCommitter stagingFileCommitter,
ZeroRowFileCreator zeroRowFileCreator,
PartitionObjectBuilder partitionObjectBuilder,
HiveEncryptionInformationProvider encryptionInformationProvider,
HivePartitionStats hivePartitionStats,
HiveFileRenamer hiveFileRenamer) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
beginQuery, cleanupQuery, finishDelete, listTables, listViews, resolveIndex, schemaExists, truncateTable
public static final String PRESTO_VERSION_NAME
public static final String TABLE_COMMENT
public static final String REFERENCED_MATERIALIZED_VIEWS
public HiveMetadata(SemiTransactionalHiveMetastore metastore, HdfsEnvironment hdfsEnvironment, HivePartitionManager partitionManager, org.joda.time.DateTimeZone timeZone, boolean allowCorruptWritesForTesting, boolean writesToNonManagedTablesEnabled, boolean createsOfNonManagedTablesEnabled, int maxPartitionBatchSize, TypeManager typeManager, LocationService locationService, StandardFunctionResolution functionResolution, RowExpressionService rowExpressionService, FilterStatsCalculatorService filterStatsCalculatorService, TableParameterCodec tableParameterCodec, com.facebook.airlift.json.JsonCodec<PartitionUpdate> partitionUpdateCodec, com.facebook.airlift.json.smile.SmileCodec<PartitionUpdate> partitionUpdateSmileCodec, TypeTranslator typeTranslator, String prestoVersion, HiveStatisticsProvider hiveStatisticsProvider, StagingFileCommitter stagingFileCommitter, ZeroRowFileCreator zeroRowFileCreator, PartitionObjectBuilder partitionObjectBuilder, HiveEncryptionInformationProvider encryptionInformationProvider, HivePartitionStats hivePartitionStats, HiveFileRenamer hiveFileRenamer)
public SemiTransactionalHiveMetastore getMetastore()
getMetastore
in interface TransactionalMetadata
public List<String> listSchemaNames(ConnectorSession session)
listSchemaNames
in interface ConnectorMetadata
public HiveTableHandle getTableHandle(ConnectorSession session, SchemaTableName tableName)
getTableHandle
in interface ConnectorMetadata
public ConnectorTableHandle getTableHandleForStatisticsCollection(ConnectorSession session, SchemaTableName tableName, Map<String,Object> analyzeProperties)
getTableHandleForStatisticsCollection
in interface ConnectorMetadata
public Optional<SystemTable> getSystemTable(ConnectorSession session, SchemaTableName tableName)
getSystemTable
in interface ConnectorMetadata
public ConnectorTableMetadata getTableMetadata(ConnectorSession session, ConnectorTableHandle tableHandle)
getTableMetadata
in interface ConnectorMetadata
protected Optional<? extends TableEncryptionProperties> getTableEncryptionPropertiesFromHiveProperties(Map<String,String> parameters, HiveStorageFormat storageFormat)
public Optional<Object> getInfo(ConnectorTableLayoutHandle layoutHandle)
getInfo
in interface ConnectorMetadata
public List<SchemaTableName> listTables(ConnectorSession session, String schemaNameOrNull)
listTables
in interface ConnectorMetadata
public Map<String,ColumnHandle> getColumnHandles(ConnectorSession session, ConnectorTableHandle tableHandle)
getColumnHandles
in interface ConnectorMetadata
public Map<SchemaTableName,List<ColumnMetadata>> listTableColumns(ConnectorSession session, SchemaTablePrefix prefix)
listTableColumns
in interface ConnectorMetadata
public TableStatistics getTableStatistics(ConnectorSession session, ConnectorTableHandle tableHandle, Optional<ConnectorTableLayoutHandle> tableLayoutHandle, List<ColumnHandle> columnHandles, Constraint<ColumnHandle> constraint)
getTableStatistics
in interface ConnectorMetadata
public ColumnMetadata getColumnMetadata(ConnectorSession session, ConnectorTableHandle tableHandle, ColumnHandle columnHandle)
getColumnMetadata
in interface ConnectorMetadata
public TupleDomain<ColumnHandle> toExplainIOConstraints(ConnectorSession session, ConnectorTableHandle tableHandle, TupleDomain<ColumnHandle> constraints)
Only Hive partition columns that are used in IO planning.
toExplainIOConstraints
in interface ConnectorMetadata
public void createSchema(ConnectorSession session, String schemaName, Map<String,Object> properties)
createSchema
in interface ConnectorMetadata
public void dropSchema(ConnectorSession session, String schemaName)
dropSchema
in interface ConnectorMetadata
public void renameSchema(ConnectorSession session, String source, String target)
renameSchema
in interface ConnectorMetadata
public void createTable(ConnectorSession session, ConnectorTableMetadata tableMetadata, boolean ignoreExisting)
createTable
in interface ConnectorMetadata
public ConnectorTableHandle createTemporaryTable(ConnectorSession session, List<ColumnMetadata> columns, Optional<ConnectorPartitioningMetadata> partitioningMetadata)
createTemporaryTable
in interface ConnectorMetadata
public void addColumn(ConnectorSession session, ConnectorTableHandle tableHandle, ColumnMetadata column)
addColumn
in interface ConnectorMetadata
public void renameColumn(ConnectorSession session, ConnectorTableHandle tableHandle, ColumnHandle source, String target)
renameColumn
in interface ConnectorMetadata
public void dropColumn(ConnectorSession session, ConnectorTableHandle tableHandle, ColumnHandle column)
dropColumn
in interface ConnectorMetadata
public void renameTable(ConnectorSession session, ConnectorTableHandle tableHandle, SchemaTableName newTableName)
renameTable
in interface ConnectorMetadata
public void dropTable(ConnectorSession session, ConnectorTableHandle tableHandle)
dropTable
in interface ConnectorMetadata
public ConnectorTableHandle beginStatisticsCollection(ConnectorSession session, ConnectorTableHandle tableHandle)
beginStatisticsCollection
in interface ConnectorMetadata
public void finishStatisticsCollection(ConnectorSession session, ConnectorTableHandle tableHandle, Collection<ComputedStatistics> computedStatistics)
finishStatisticsCollection
in interface ConnectorMetadata
public HiveOutputTableHandle beginCreateTable(ConnectorSession session, ConnectorTableMetadata tableMetadata, Optional<ConnectorNewTableLayout> layout)
beginCreateTable
in interface ConnectorMetadata
public Optional<ConnectorOutputMetadata> finishCreateTable(ConnectorSession session, ConnectorOutputTableHandle tableHandle, Collection<io.airlift.slice.Slice> fragments, Collection<ComputedStatistics> computedStatistics)
finishCreateTable
in interface ConnectorMetadata
public static boolean shouldCreateFilesForMissingBuckets(Table table, ConnectorSession session)
public HiveInsertTableHandle beginInsert(ConnectorSession session, ConnectorTableHandle tableHandle)
beginInsert
in interface ConnectorMetadata
public Optional<ConnectorOutputMetadata> finishInsert(ConnectorSession session, ConnectorInsertTableHandle insertHandle, Collection<io.airlift.slice.Slice> fragments, Collection<ComputedStatistics> computedStatistics)
finishInsert
in interface ConnectorMetadata
public void createView(ConnectorSession session, ConnectorTableMetadata viewMetadata, String viewData, boolean replace)
createView
in interface ConnectorMetadata
public void dropView(ConnectorSession session, SchemaTableName viewName)
dropView
in interface ConnectorMetadata
public List<SchemaTableName> listViews(ConnectorSession session, String schemaNameOrNull)
listViews
in interface ConnectorMetadata
public Map<SchemaTableName,ConnectorViewDefinition> getViews(ConnectorSession session, SchemaTablePrefix prefix)
getViews
in interface ConnectorMetadata
public Optional<ConnectorMaterializedViewDefinition> getMaterializedView(ConnectorSession session, SchemaTableName viewName)
getMaterializedView
in interface ConnectorMetadata
public MaterializedViewStatus getMaterializedViewStatus(ConnectorSession session, SchemaTableName materializedViewName)
getMaterializedViewStatus
in interface ConnectorMetadata
public void createMaterializedView(ConnectorSession session, ConnectorTableMetadata viewMetadata, ConnectorMaterializedViewDefinition viewDefinition, boolean ignoreExisting)
createMaterializedView
in interface ConnectorMetadata
public void dropMaterializedView(ConnectorSession session, SchemaTableName viewName)
dropMaterializedView
in interface ConnectorMetadata
public HiveInsertTableHandle beginRefreshMaterializedView(ConnectorSession session, ConnectorTableHandle tableHandle)
beginRefreshMaterializedView
in interface ConnectorMetadata
public Optional<ConnectorOutputMetadata> finishRefreshMaterializedView(ConnectorSession session, ConnectorInsertTableHandle insertHandle, Collection<io.airlift.slice.Slice> fragments, Collection<ComputedStatistics> computedStatistics)
finishRefreshMaterializedView
in interface ConnectorMetadata
public Optional<List<SchemaTableName>> getReferencedMaterializedViews(ConnectorSession session, SchemaTableName tableName)
getReferencedMaterializedViews
in interface ConnectorMetadata
public ConnectorTableHandle beginDelete(ConnectorSession session, ConnectorTableHandle tableHandle)
beginDelete
in interface ConnectorMetadata
public ColumnHandle getUpdateRowIdColumnHandle(ConnectorSession session, ConnectorTableHandle tableHandle)
getUpdateRowIdColumnHandle
in interface ConnectorMetadata
public OptionalLong metadataDelete(ConnectorSession session, ConnectorTableHandle tableHandle, ConnectorTableLayoutHandle tableLayoutHandle)
metadataDelete
in interface ConnectorMetadata
public boolean supportsMetadataDelete(ConnectorSession session, ConnectorTableHandle tableHandle, Optional<ConnectorTableLayoutHandle> tableLayoutHandle)
supportsMetadataDelete
in interface ConnectorMetadata
public boolean isLegacyGetLayoutSupported(ConnectorSession session, ConnectorTableHandle tableHandle)
isLegacyGetLayoutSupported
in interface ConnectorMetadata
public List<ConnectorTableLayoutResult> getTableLayouts(ConnectorSession session, ConnectorTableHandle tableHandle, Constraint<ColumnHandle> constraint, Optional<Set<ColumnHandle>> desiredColumns)
getTableLayouts
in interface ConnectorMetadata
public ConnectorTableLayout getTableLayout(ConnectorSession session, ConnectorTableLayoutHandle layoutHandle)
getTableLayout
in interface ConnectorMetadata
public Optional<ConnectorPartitioningHandle> getCommonPartitioningHandle(ConnectorSession session, ConnectorPartitioningHandle left, ConnectorPartitioningHandle right)
getCommonPartitioningHandle
in interface ConnectorMetadata
public boolean isRefinedPartitioningOver(ConnectorSession session, ConnectorPartitioningHandle left, ConnectorPartitioningHandle right)
isRefinedPartitioningOver
in interface ConnectorMetadata
public ConnectorTableLayoutHandle getAlternativeLayoutHandle(ConnectorSession session, ConnectorTableLayoutHandle tableLayoutHandle, ConnectorPartitioningHandle partitioningHandle)
getAlternativeLayoutHandle
in interface ConnectorMetadata
public ConnectorPartitioningHandle getPartitioningHandleForExchange(ConnectorSession session, int partitionCount, List<Type> partitionTypes)
getPartitioningHandleForExchange
in interface ConnectorMetadata
public Optional<ConnectorNewTableLayout> getInsertLayout(ConnectorSession session, ConnectorTableHandle tableHandle)
getInsertLayout
in interface ConnectorMetadata
public Optional<ConnectorNewTableLayout> getPreferredShuffleLayoutForInsert(ConnectorSession session, ConnectorTableHandle tableHandle)
getPreferredShuffleLayoutForInsert
in interface ConnectorMetadata
public Optional<ConnectorNewTableLayout> getNewTableLayout(ConnectorSession session, ConnectorTableMetadata tableMetadata)
getNewTableLayout
in interface ConnectorMetadata
public Optional<ConnectorNewTableLayout> getPreferredShuffleLayoutForNewTable(ConnectorSession session, ConnectorTableMetadata tableMetadata)
getPreferredShuffleLayoutForNewTable
in interface ConnectorMetadata
public TableStatisticsMetadata getStatisticsCollectionMetadataForWrite(ConnectorSession session, ConnectorTableMetadata tableMetadata)
getStatisticsCollectionMetadataForWrite
in interface ConnectorMetadata
public TableStatisticsMetadata getStatisticsCollectionMetadata(ConnectorSession session, ConnectorTableMetadata tableMetadata)
getStatisticsCollectionMetadata
in interface ConnectorMetadata
public void createRole(ConnectorSession session, String role, Optional<PrestoPrincipal> grantor)
createRole
in interface ConnectorMetadata
public void dropRole(ConnectorSession session, String role)
dropRole
in interface ConnectorMetadata
public Set<String> listRoles(ConnectorSession session)
listRoles
in interface ConnectorMetadata
public Set<RoleGrant> listRoleGrants(ConnectorSession session, PrestoPrincipal principal)
listRoleGrants
in interface ConnectorMetadata
public void grantRoles(ConnectorSession session, Set<String> roles, Set<PrestoPrincipal> grantees, boolean withAdminOption, Optional<PrestoPrincipal> grantor)
grantRoles
in interface ConnectorMetadata
public void revokeRoles(ConnectorSession session, Set<String> roles, Set<PrestoPrincipal> grantees, boolean adminOptionFor, Optional<PrestoPrincipal> grantor)
revokeRoles
in interface ConnectorMetadata
public Set<RoleGrant> listApplicableRoles(ConnectorSession session, PrestoPrincipal principal)
listApplicableRoles
in interface ConnectorMetadata
public Set<String> listEnabledRoles(ConnectorSession session)
listEnabledRoles
in interface ConnectorMetadata
public void grantTablePrivileges(ConnectorSession session, SchemaTableName schemaTableName, Set<Privilege> privileges, PrestoPrincipal grantee, boolean grantOption)
grantTablePrivileges
in interface ConnectorMetadata
public void revokeTablePrivileges(ConnectorSession session, SchemaTableName schemaTableName, Set<Privilege> privileges, PrestoPrincipal grantee, boolean grantOption)
revokeTablePrivileges
in interface ConnectorMetadata
public List<GrantInfo> listTablePrivileges(ConnectorSession session, SchemaTablePrefix schemaTablePrefix)
listTablePrivileges
in interface ConnectorMetadata
public CompletableFuture<Void> commitPageSinkAsync(ConnectorSession session, ConnectorOutputTableHandle tableHandle, Collection<io.airlift.slice.Slice> fragments)
commitPageSinkAsync
in interface ConnectorMetadata
public CompletableFuture<Void> commitPageSinkAsync(ConnectorSession session, ConnectorInsertTableHandle tableHandle, Collection<io.airlift.slice.Slice> fragments)
commitPageSinkAsync
in interface ConnectorMetadata
public List<ConnectorMetadataUpdateHandle> getMetadataUpdateResults(List<ConnectorMetadataUpdateHandle> metadataUpdateRequests, QueryId queryId)
getMetadataUpdateResults
in interface ConnectorMetadata
public void doMetadataUpdateCleanup(QueryId queryId)
doMetadataUpdateCleanup
in interface ConnectorMetadata
public List<PartitionUpdate> getPartitionUpdates(ConnectorSession session, Collection<io.airlift.slice.Slice> fragments)
protected Optional<TableEncryptionProperties> getTableEncryptionPropertiesFromTableProperties(ConnectorTableMetadata tableMetadata, HiveStorageFormat hiveStorageFormat, List<String> partitionedBy)
public void rollback()
rollback
in interface TransactionalMetadata
public void commit()
commit
in interface TransactionalMetadata
public TableLayoutFilterCoverage getTableLayoutFilterCoverage(ConnectorTableLayoutHandle connectorTableLayoutHandle, Set<String> relevantPartitionColumns)
getTableLayoutFilterCoverage
in interface ConnectorMetadata
public static Optional<SchemaTableName> getSourceTableNameFromSystemTable(SchemaTableName tableName)
Copyright © 2012–2022. All rights reserved.