Package io.prestosql.metadata
Class MetadataManager
- java.lang.Object
-
- io.prestosql.metadata.MetadataManager
-
-
Constructor Summary
Constructors Constructor Description MetadataManager(FeaturesConfig featuresConfig, SessionPropertyManager sessionPropertyManager, SchemaPropertyManager schemaPropertyManager, TablePropertyManager tablePropertyManager, ColumnPropertyManager columnPropertyManager, AnalyzePropertyManager analyzePropertyManager, TransactionManager transactionManager, TypeOperators typeOperators, BlockTypeOperators blockTypeOperators)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addBlockEncoding(BlockEncoding blockEncoding)
void
addColumn(Session session, TableHandle tableHandle, ColumnMetadata column)
Add the specified column to the table.void
addFunctions(List<? extends SqlFunction> functionInfos)
void
addParametricType(ParametricType parametricType)
void
addType(Type type)
Optional<AggregationApplicationResult<TableHandle>>
applyAggregation(Session session, TableHandle table, List<AggregateFunction> aggregations, Map<String,ColumnHandle> assignments, List<List<ColumnHandle>> groupingSets)
Optional<TableHandle>
applyDelete(Session session, TableHandle table)
Push delete into connectorOptional<ConstraintApplicationResult<TableHandle>>
applyFilter(Session session, TableHandle table, Constraint constraint)
Optional<LimitApplicationResult<TableHandle>>
applyLimit(Session session, TableHandle table, long limit)
Optional<ProjectionApplicationResult<TableHandle>>
applyProjection(Session session, TableHandle table, List<ConnectorExpression> projections, Map<String,ColumnHandle> assignments)
Optional<TableHandle>
applySample(Session session, TableHandle table, SampleType sampleType, double sampleRatio)
Optional<TopNApplicationResult<TableHandle>>
applyTopN(Session session, TableHandle table, long topNCount, List<SortItem> sortItems, Map<String,ColumnHandle> assignments)
OutputTableHandle
beginCreateTable(Session session, String catalogName, ConnectorTableMetadata tableMetadata, Optional<NewTableLayout> layout)
Begin the atomic creation of a table with data.TableHandle
beginDelete(Session session, TableHandle tableHandle)
Begin delete queryInsertTableHandle
beginInsert(Session session, TableHandle tableHandle, List<ColumnHandle> columns)
Begin insert queryInsertTableHandle
beginRefreshMaterializedView(Session session, TableHandle tableHandle)
Begin refresh materialized view queryAnalyzeTableHandle
beginStatisticsCollection(Session session, TableHandle tableHandle)
Begin statistics collectionboolean
catalogExists(Session session, String catalogName)
void
cleanupQuery(Session session)
Cleanup after a query.void
createMaterializedView(Session session, QualifiedObjectName viewName, ConnectorMaterializedViewDefinition definition, boolean replace, boolean ignoreExisting)
Creates the specified materialized view with the specified view definition.void
createRole(Session session, String role, Optional<PrestoPrincipal> grantor, String catalog)
Creates the specified role in the specified catalog.void
createSchema(Session session, CatalogSchemaName schema, Map<String,Object> properties, PrestoPrincipal principal)
Creates a schema.void
createTable(Session session, String catalogName, ConnectorTableMetadata tableMetadata, boolean ignoreExisting)
Creates a table using the specified table metadata.static MetadataManager
createTestMetadataManager()
static MetadataManager
createTestMetadataManager(CatalogManager catalogManager)
static MetadataManager
createTestMetadataManager(CatalogManager catalogManager, FeaturesConfig featuresConfig)
static MetadataManager
createTestMetadataManager(FeaturesConfig featuresConfig)
static MetadataManager
createTestMetadataManager(TransactionManager transactionManager, FeaturesConfig featuresConfig)
void
createView(Session session, QualifiedObjectName viewName, ConnectorViewDefinition definition, boolean replace)
Creates the specified view with the specified view definition.ResolvedFunction
decodeFunction(QualifiedName name)
void
dropColumn(Session session, TableHandle tableHandle, ColumnHandle column)
Drop the specified column.void
dropMaterializedView(Session session, QualifiedObjectName viewName)
Drops the specified materialized view.void
dropRole(Session session, String role, String catalog)
Drops the specified role in the specified catalog.void
dropSchema(Session session, CatalogSchemaName schema)
Drops the specified schema.void
dropTable(Session session, TableHandle tableHandle)
Drops the specified tablevoid
dropView(Session session, QualifiedObjectName viewName)
Drops the specified view.OptionalLong
executeDelete(Session session, TableHandle table)
Execute delete in connectorOptional<ConnectorOutputMetadata>
finishCreateTable(Session session, OutputTableHandle tableHandle, Collection<io.airlift.slice.Slice> fragments, Collection<ComputedStatistics> computedStatistics)
Finish a table creation with data after the data is written.void
finishDelete(Session session, TableHandle tableHandle, Collection<io.airlift.slice.Slice> fragments)
Finish delete queryOptional<ConnectorOutputMetadata>
finishInsert(Session session, InsertTableHandle tableHandle, Collection<io.airlift.slice.Slice> fragments, Collection<ComputedStatistics> computedStatistics)
Finish insert queryOptional<ConnectorOutputMetadata>
finishRefreshMaterializedView(Session session, InsertTableHandle tableHandle, Collection<io.airlift.slice.Slice> fragments, Collection<ComputedStatistics> computedStatistics, List<TableHandle> sourceTableHandles)
Finish refresh materialized view queryvoid
finishStatisticsCollection(Session session, AnalyzeTableHandle tableHandle, Collection<ComputedStatistics> computedStatistics)
Finish statistics collectionType
fromSqlType(String sqlType)
Set<QueryId>
getActiveQueryIds()
InternalAggregationFunction
getAggregateFunctionImplementation(ResolvedFunction resolvedFunction)
AggregationFunctionMetadata
getAggregationFunctionMetadata(ResolvedFunction resolvedFunction)
AnalyzePropertyManager
getAnalyzePropertyManager()
BlockEncoding
getBlockEncoding(String encodingName)
BlockEncodingSerde
getBlockEncodingSerde()
Optional<CatalogName>
getCatalogHandle(Session session, String catalogName)
Returns a connector id for the specified catalog name.Map<String,CatalogName>
getCatalogNames(Session session)
Gets all the loaded catalogsResolvedFunction
getCoercion(OperatorType operatorType, Type fromType, Type toType)
ResolvedFunction
getCoercion(QualifiedName name, Type fromType, Type toType)
Map<String,ColumnHandle>
getColumnHandles(Session session, TableHandle tableHandle)
Gets all of the columns on the specified table, or an empty map if the columns cannot be enumerated.ColumnMetadata
getColumnMetadata(Session session, TableHandle tableHandle, ColumnHandle columnHandle)
Gets the metadata for the specified table column.ColumnPropertyManager
getColumnPropertyManager()
Optional<PartitioningHandle>
getCommonPartitioning(Session session, PartitioningHandle left, PartitioningHandle right)
Return a partitioning handle which the connector can transparently convert bothleft
andright
into.Set<ConnectorCapabilities>
getConnectorCapabilities(Session session, CatalogName catalogName)
FunctionMetadata
getFunctionMetadata(ResolvedFunction resolvedFunction)
Optional<Object>
getInfo(Session session, TableHandle handle)
Optional<NewTableLayout>
getInsertLayout(Session session, TableHandle table)
Optional<TableLayoutResult>
getLayout(Session session, TableHandle table, Constraint constraint, Optional<Set<ColumnHandle>> desiredColumns)
Optional<ConnectorMaterializedViewDefinition>
getMaterializedView(Session session, QualifiedObjectName viewName)
Returns the materialized view definition for the specified view name.MaterializedViewFreshness
getMaterializedViewFreshness(Session session, TableHandle tableHandle)
Method to get difference between the states of table at two different points in time/or as of given token-ids.Optional<NewTableLayout>
getNewTableLayout(Session session, String catalogName, ConnectorTableMetadata tableMetadata)
Collection<ParametricType>
getParametricTypes()
ProcedureRegistry
getProcedureRegistry()
FunctionInvoker
getScalarFunctionInvoker(ResolvedFunction resolvedFunction, Optional<InvocationConvention> invocationConvention)
Optional<PrestoPrincipal>
getSchemaOwner(Session session, CatalogSchemaName schemaName)
Gets the schema owner for the specified schema.Map<String,Object>
getSchemaProperties(Session session, CatalogSchemaName schemaName)
Gets the schema properties for the specified schema.SchemaPropertyManager
getSchemaPropertyManager()
SessionPropertyManager
getSessionPropertyManager()
TableStatisticsMetadata
getStatisticsCollectionMetadata(Session session, String catalogName, ConnectorTableMetadata tableMetadata)
Describe statistics that must be collected during a statistics collectionTableStatisticsMetadata
getStatisticsCollectionMetadataForWrite(Session session, String catalogName, ConnectorTableMetadata tableMetadata)
Describes statistics that must be collected during a write.Optional<SystemTable>
getSystemTable(Session session, QualifiedObjectName tableName)
Optional<TableHandle>
getTableHandle(Session session, QualifiedObjectName table)
Returns a table handle for the specified table name.Optional<TableHandle>
getTableHandleForStatisticsCollection(Session session, QualifiedObjectName table, Map<String,Object> analyzeProperties)
TableMetadata
getTableMetadata(Session session, TableHandle tableHandle)
Return the metadata for the specified table handle.TableProperties
getTableProperties(Session session, TableHandle handle)
TablePropertyManager
getTablePropertyManager()
TableStatistics
getTableStatistics(Session session, TableHandle tableHandle, Constraint constraint)
Return statistics for specified table for given filtering contraint.Type
getType(TypeId id)
Type
getType(TypeSignature signature)
Collection<Type>
getTypes()
ColumnHandle
getUpdateRowIdColumnHandle(Session session, TableHandle tableHandle)
Get the row ID column handle used with UpdatablePageSource.Optional<ConnectorViewDefinition>
getView(Session session, QualifiedObjectName viewName)
Returns the view definition for the specified view name.Map<QualifiedObjectName,ConnectorViewDefinition>
getViews(Session session, QualifiedTablePrefix prefix)
Get the view definitions that match the specified table prefix (never null).WindowFunctionSupplier
getWindowFunctionImplementation(ResolvedFunction resolvedFunction)
void
grantRoles(Session session, Set<String> roles, Set<PrestoPrincipal> grantees, boolean adminOption, Optional<PrestoPrincipal> grantor, String catalog)
Grants the specified roles to the specified grantees in the specified catalogvoid
grantTablePrivileges(Session session, QualifiedObjectName tableName, Set<Privilege> privileges, PrestoPrincipal grantee, boolean grantOption)
Grants the specified privilege to the specified user on the specified tableboolean
isAggregationFunction(QualifiedName name)
Is the named function an aggregation function? This does not need type parameters because overloads between aggregation and other function types are not allowed.Set<RoleGrant>
listAllRoleGrants(Session session, String catalog, Optional<Set<String>> roles, Optional<Set<String>> grantees, OptionalLong limit)
List all role grants in the specified catalog, optionally filtered by passed role, grantee, and limit predicates.Set<RoleGrant>
listApplicableRoles(Session session, PrestoPrincipal principal, String catalog)
List applicable roles, including the transitive grants, for the specified principalSet<String>
listEnabledRoles(Session session, String catalog)
List applicable roles, including the transitive grants, in given sessionList<FunctionMetadata>
listFunctions()
Set<RoleGrant>
listRoleGrants(Session session, String catalog, PrestoPrincipal principal)
List roles grants in the specified catalog for a given principal, not recursively.Set<String>
listRoles(Session session, String catalog)
List available roles in specified catalog.List<String>
listSchemaNames(Session session, String catalogName)
Map<QualifiedObjectName,List<ColumnMetadata>>
listTableColumns(Session session, QualifiedTablePrefix prefix)
Gets the metadata for all columns that match the specified table prefix.List<GrantInfo>
listTablePrivileges(Session session, QualifiedTablePrefix prefix)
Gets the privileges for the specified table available to the given grantee considering the selected session roleList<QualifiedObjectName>
listTables(Session session, QualifiedTablePrefix prefix)
Get the names that match the specified table prefix (never null).List<QualifiedObjectName>
listViews(Session session, QualifiedTablePrefix prefix)
Get the names that match the specified table prefix (never null).TableHandle
makeCompatiblePartitioning(Session session, TableHandle tableHandle, PartitioningHandle partitioningHandle)
Return a table handle whose partitioning is converted to the provided partitioning handle, but otherwise identical to the provided table handle.void
renameColumn(Session session, TableHandle tableHandle, ColumnHandle source, String target)
Rename the specified column.void
renameSchema(Session session, CatalogSchemaName source, String target)
Renames the specified schema.void
renameTable(Session session, TableHandle tableHandle, QualifiedObjectName newTableName)
Rename the specified table.void
renameView(Session session, QualifiedObjectName source, QualifiedObjectName target)
Rename the specified view.ResolvedFunction
resolve(FunctionBinding functionBinding, FunctionDependencyDeclaration declaration)
ResolvedFunction
resolveFunction(QualifiedName name, List<TypeSignatureProvider> parameterTypes)
Optional<ResolvedIndex>
resolveIndex(Session session, TableHandle tableHandle, Set<ColumnHandle> indexableColumns, Set<ColumnHandle> outputColumns, TupleDomain<ColumnHandle> tupleDomain)
Try to locate a table index that can lookup results by indexableColumns and provide the requested outputColumns.ResolvedFunction
resolveOperator(OperatorType operatorType, List<? extends Type> argumentTypes)
void
revokeRoles(Session session, Set<String> roles, Set<PrestoPrincipal> grantees, boolean adminOption, Optional<PrestoPrincipal> grantor, String catalog)
Revokes the specified roles from the specified grantees in the specified catalogvoid
revokeTablePrivileges(Session session, QualifiedObjectName tableName, Set<Privilege> privileges, PrestoPrincipal grantee, boolean grantOption)
Revokes the specified privilege on the specified table from the specified userboolean
schemaExists(Session session, CatalogSchemaName schema)
void
setColumnComment(Session session, TableHandle tableHandle, ColumnHandle column, Optional<String> comment)
Comments to the specified column.void
setSchemaAuthorization(Session session, CatalogSchemaName source, PrestoPrincipal principal)
Set the specified schema's user/role.void
setTableComment(Session session, TableHandle tableHandle, Optional<String> comment)
Comments to the specified table.boolean
supportsMetadataDelete(Session session, TableHandle tableHandle)
boolean
supportsMissingColumnsOnInsert(Session session, TableHandle tableHandle)
static FunctionBinding
toFunctionBinding(FunctionId functionId, BoundSignature boundSignature, Signature functionSignature)
boolean
usesLegacyTableLayouts(Session session, TableHandle table)
void
validateScan(Session session, TableHandle table)
void
verifyTypes()
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface io.prestosql.metadata.Metadata
getCoercion, getParameterizedType
-
-
-
-
Constructor Detail
-
MetadataManager
@Inject public MetadataManager(FeaturesConfig featuresConfig, SessionPropertyManager sessionPropertyManager, SchemaPropertyManager schemaPropertyManager, TablePropertyManager tablePropertyManager, ColumnPropertyManager columnPropertyManager, AnalyzePropertyManager analyzePropertyManager, TransactionManager transactionManager, TypeOperators typeOperators, BlockTypeOperators blockTypeOperators)
-
-
Method Detail
-
createTestMetadataManager
public static MetadataManager createTestMetadataManager()
-
createTestMetadataManager
public static MetadataManager createTestMetadataManager(FeaturesConfig featuresConfig)
-
createTestMetadataManager
public static MetadataManager createTestMetadataManager(CatalogManager catalogManager)
-
createTestMetadataManager
public static MetadataManager createTestMetadataManager(CatalogManager catalogManager, FeaturesConfig featuresConfig)
-
createTestMetadataManager
public static MetadataManager createTestMetadataManager(TransactionManager transactionManager, FeaturesConfig featuresConfig)
-
getConnectorCapabilities
public Set<ConnectorCapabilities> getConnectorCapabilities(Session session, CatalogName catalogName)
- Specified by:
getConnectorCapabilities
in interfaceMetadata
-
catalogExists
public boolean catalogExists(Session session, String catalogName)
- Specified by:
catalogExists
in interfaceMetadata
-
schemaExists
public boolean schemaExists(Session session, CatalogSchemaName schema)
- Specified by:
schemaExists
in interfaceMetadata
-
listSchemaNames
public List<String> listSchemaNames(Session session, String catalogName)
- Specified by:
listSchemaNames
in interfaceMetadata
-
getTableHandle
public Optional<TableHandle> getTableHandle(Session session, QualifiedObjectName table)
Description copied from interface:Metadata
Returns a table handle for the specified table name.- Specified by:
getTableHandle
in interfaceMetadata
-
getTableHandleForStatisticsCollection
public Optional<TableHandle> getTableHandleForStatisticsCollection(Session session, QualifiedObjectName table, Map<String,Object> analyzeProperties)
- Specified by:
getTableHandleForStatisticsCollection
in interfaceMetadata
-
getSystemTable
public Optional<SystemTable> getSystemTable(Session session, QualifiedObjectName tableName)
- Specified by:
getSystemTable
in interfaceMetadata
-
getLayout
public Optional<TableLayoutResult> getLayout(Session session, TableHandle table, Constraint constraint, Optional<Set<ColumnHandle>> desiredColumns)
-
getTableProperties
public TableProperties getTableProperties(Session session, TableHandle handle)
- Specified by:
getTableProperties
in interfaceMetadata
-
makeCompatiblePartitioning
public TableHandle makeCompatiblePartitioning(Session session, TableHandle tableHandle, PartitioningHandle partitioningHandle)
Description copied from interface:Metadata
Return a table handle whose partitioning is converted to the provided partitioning handle, but otherwise identical to the provided table handle. The provided table handle must be one that the connector can transparently convert to from the original partitioning handle associated with the provided table handle, as promised byMetadata.getCommonPartitioning(io.prestosql.Session, io.prestosql.sql.planner.PartitioningHandle, io.prestosql.sql.planner.PartitioningHandle)
.- Specified by:
makeCompatiblePartitioning
in interfaceMetadata
-
getCommonPartitioning
public Optional<PartitioningHandle> getCommonPartitioning(Session session, PartitioningHandle left, PartitioningHandle right)
Description copied from interface:Metadata
Return a partitioning handle which the connector can transparently convert bothleft
andright
into.- Specified by:
getCommonPartitioning
in interfaceMetadata
-
getInfo
public Optional<Object> getInfo(Session session, TableHandle handle)
-
getTableMetadata
public TableMetadata getTableMetadata(Session session, TableHandle tableHandle)
Description copied from interface:Metadata
Return the metadata for the specified table handle.- Specified by:
getTableMetadata
in interfaceMetadata
-
getTableStatistics
public TableStatistics getTableStatistics(Session session, TableHandle tableHandle, Constraint constraint)
Description copied from interface:Metadata
Return statistics for specified table for given filtering contraint.- Specified by:
getTableStatistics
in interfaceMetadata
-
getColumnHandles
public Map<String,ColumnHandle> getColumnHandles(Session session, TableHandle tableHandle)
Description copied from interface:Metadata
Gets all of the columns on the specified table, or an empty map if the columns cannot be enumerated.- Specified by:
getColumnHandles
in interfaceMetadata
-
getColumnMetadata
public ColumnMetadata getColumnMetadata(Session session, TableHandle tableHandle, ColumnHandle columnHandle)
Description copied from interface:Metadata
Gets the metadata for the specified table column.- Specified by:
getColumnMetadata
in interfaceMetadata
-
listTables
public List<QualifiedObjectName> listTables(Session session, QualifiedTablePrefix prefix)
Description copied from interface:Metadata
Get the names that match the specified table prefix (never null).- Specified by:
listTables
in interfaceMetadata
-
listTableColumns
public Map<QualifiedObjectName,List<ColumnMetadata>> listTableColumns(Session session, QualifiedTablePrefix prefix)
Description copied from interface:Metadata
Gets the metadata for all columns that match the specified table prefix.- Specified by:
listTableColumns
in interfaceMetadata
-
createSchema
public void createSchema(Session session, CatalogSchemaName schema, Map<String,Object> properties, PrestoPrincipal principal)
Description copied from interface:Metadata
Creates a schema.- Specified by:
createSchema
in interfaceMetadata
principal
- TODO
-
dropSchema
public void dropSchema(Session session, CatalogSchemaName schema)
Description copied from interface:Metadata
Drops the specified schema.- Specified by:
dropSchema
in interfaceMetadata
-
renameSchema
public void renameSchema(Session session, CatalogSchemaName source, String target)
Description copied from interface:Metadata
Renames the specified schema.- Specified by:
renameSchema
in interfaceMetadata
-
setSchemaAuthorization
public void setSchemaAuthorization(Session session, CatalogSchemaName source, PrestoPrincipal principal)
Description copied from interface:Metadata
Set the specified schema's user/role.- Specified by:
setSchemaAuthorization
in interfaceMetadata
-
createTable
public void createTable(Session session, String catalogName, ConnectorTableMetadata tableMetadata, boolean ignoreExisting)
Description copied from interface:Metadata
Creates a table using the specified table metadata.- Specified by:
createTable
in interfaceMetadata
-
renameTable
public void renameTable(Session session, TableHandle tableHandle, QualifiedObjectName newTableName)
Description copied from interface:Metadata
Rename the specified table.- Specified by:
renameTable
in interfaceMetadata
-
setTableComment
public void setTableComment(Session session, TableHandle tableHandle, Optional<String> comment)
Description copied from interface:Metadata
Comments to the specified table.- Specified by:
setTableComment
in interfaceMetadata
-
setColumnComment
public void setColumnComment(Session session, TableHandle tableHandle, ColumnHandle column, Optional<String> comment)
Description copied from interface:Metadata
Comments to the specified column.- Specified by:
setColumnComment
in interfaceMetadata
-
renameColumn
public void renameColumn(Session session, TableHandle tableHandle, ColumnHandle source, String target)
Description copied from interface:Metadata
Rename the specified column.- Specified by:
renameColumn
in interfaceMetadata
-
addColumn
public void addColumn(Session session, TableHandle tableHandle, ColumnMetadata column)
Description copied from interface:Metadata
Add the specified column to the table.
-
dropColumn
public void dropColumn(Session session, TableHandle tableHandle, ColumnHandle column)
Description copied from interface:Metadata
Drop the specified column.- Specified by:
dropColumn
in interfaceMetadata
-
dropTable
public void dropTable(Session session, TableHandle tableHandle)
Description copied from interface:Metadata
Drops the specified table
-
getInsertLayout
public Optional<NewTableLayout> getInsertLayout(Session session, TableHandle table)
- Specified by:
getInsertLayout
in interfaceMetadata
-
getStatisticsCollectionMetadataForWrite
public TableStatisticsMetadata getStatisticsCollectionMetadataForWrite(Session session, String catalogName, ConnectorTableMetadata tableMetadata)
Description copied from interface:Metadata
Describes statistics that must be collected during a write.- Specified by:
getStatisticsCollectionMetadataForWrite
in interfaceMetadata
-
getStatisticsCollectionMetadata
public TableStatisticsMetadata getStatisticsCollectionMetadata(Session session, String catalogName, ConnectorTableMetadata tableMetadata)
Description copied from interface:Metadata
Describe statistics that must be collected during a statistics collection- Specified by:
getStatisticsCollectionMetadata
in interfaceMetadata
-
beginStatisticsCollection
public AnalyzeTableHandle beginStatisticsCollection(Session session, TableHandle tableHandle)
Description copied from interface:Metadata
Begin statistics collection- Specified by:
beginStatisticsCollection
in interfaceMetadata
-
finishStatisticsCollection
public void finishStatisticsCollection(Session session, AnalyzeTableHandle tableHandle, Collection<ComputedStatistics> computedStatistics)
Description copied from interface:Metadata
Finish statistics collection- Specified by:
finishStatisticsCollection
in interfaceMetadata
-
getNewTableLayout
public Optional<NewTableLayout> getNewTableLayout(Session session, String catalogName, ConnectorTableMetadata tableMetadata)
- Specified by:
getNewTableLayout
in interfaceMetadata
-
cleanupQuery
public void cleanupQuery(Session session)
Description copied from interface:Metadata
Cleanup after a query. This is the very last notification after the query finishes, regardless if it succeeds or fails. An exception thrown in this method will not affect the result of the query.- Specified by:
cleanupQuery
in interfaceMetadata
-
beginCreateTable
public OutputTableHandle beginCreateTable(Session session, String catalogName, ConnectorTableMetadata tableMetadata, Optional<NewTableLayout> layout)
Description copied from interface:Metadata
Begin the atomic creation of a table with data.- Specified by:
beginCreateTable
in interfaceMetadata
-
finishCreateTable
public Optional<ConnectorOutputMetadata> finishCreateTable(Session session, OutputTableHandle tableHandle, Collection<io.airlift.slice.Slice> fragments, Collection<ComputedStatistics> computedStatistics)
Description copied from interface:Metadata
Finish a table creation with data after the data is written.- Specified by:
finishCreateTable
in interfaceMetadata
-
beginInsert
public InsertTableHandle beginInsert(Session session, TableHandle tableHandle, List<ColumnHandle> columns)
Description copied from interface:Metadata
Begin insert query- Specified by:
beginInsert
in interfaceMetadata
-
supportsMissingColumnsOnInsert
public boolean supportsMissingColumnsOnInsert(Session session, TableHandle tableHandle)
- Specified by:
supportsMissingColumnsOnInsert
in interfaceMetadata
- Returns:
- whether connector handles missing columns during insert
-
finishInsert
public Optional<ConnectorOutputMetadata> finishInsert(Session session, InsertTableHandle tableHandle, Collection<io.airlift.slice.Slice> fragments, Collection<ComputedStatistics> computedStatistics)
Description copied from interface:Metadata
Finish insert query- Specified by:
finishInsert
in interfaceMetadata
-
beginRefreshMaterializedView
public InsertTableHandle beginRefreshMaterializedView(Session session, TableHandle tableHandle)
Description copied from interface:Metadata
Begin refresh materialized view query- Specified by:
beginRefreshMaterializedView
in interfaceMetadata
-
finishRefreshMaterializedView
public Optional<ConnectorOutputMetadata> finishRefreshMaterializedView(Session session, InsertTableHandle tableHandle, Collection<io.airlift.slice.Slice> fragments, Collection<ComputedStatistics> computedStatistics, List<TableHandle> sourceTableHandles)
Description copied from interface:Metadata
Finish refresh materialized view query- Specified by:
finishRefreshMaterializedView
in interfaceMetadata
-
getUpdateRowIdColumnHandle
public ColumnHandle getUpdateRowIdColumnHandle(Session session, TableHandle tableHandle)
Description copied from interface:Metadata
Get the row ID column handle used with UpdatablePageSource.- Specified by:
getUpdateRowIdColumnHandle
in interfaceMetadata
-
supportsMetadataDelete
public boolean supportsMetadataDelete(Session session, TableHandle tableHandle)
- Specified by:
supportsMetadataDelete
in interfaceMetadata
- Returns:
- whether delete without table scan is supported
-
applyDelete
public Optional<TableHandle> applyDelete(Session session, TableHandle table)
Description copied from interface:Metadata
Push delete into connector- Specified by:
applyDelete
in interfaceMetadata
-
executeDelete
public OptionalLong executeDelete(Session session, TableHandle table)
Description copied from interface:Metadata
Execute delete in connector- Specified by:
executeDelete
in interfaceMetadata
-
beginDelete
public TableHandle beginDelete(Session session, TableHandle tableHandle)
Description copied from interface:Metadata
Begin delete query- Specified by:
beginDelete
in interfaceMetadata
-
finishDelete
public void finishDelete(Session session, TableHandle tableHandle, Collection<io.airlift.slice.Slice> fragments)
Description copied from interface:Metadata
Finish delete query- Specified by:
finishDelete
in interfaceMetadata
-
getCatalogHandle
public Optional<CatalogName> getCatalogHandle(Session session, String catalogName)
Description copied from interface:Metadata
Returns a connector id for the specified catalog name.- Specified by:
getCatalogHandle
in interfaceMetadata
-
getCatalogNames
public Map<String,CatalogName> getCatalogNames(Session session)
Description copied from interface:Metadata
Gets all the loaded catalogs- Specified by:
getCatalogNames
in interfaceMetadata
- Returns:
- Map of catalog name to connector id
-
listViews
public List<QualifiedObjectName> listViews(Session session, QualifiedTablePrefix prefix)
Description copied from interface:Metadata
Get the names that match the specified table prefix (never null).
-
getViews
public Map<QualifiedObjectName,ConnectorViewDefinition> getViews(Session session, QualifiedTablePrefix prefix)
Description copied from interface:Metadata
Get the view definitions that match the specified table prefix (never null).
-
getSchemaProperties
public Map<String,Object> getSchemaProperties(Session session, CatalogSchemaName schemaName)
Description copied from interface:Metadata
Gets the schema properties for the specified schema.- Specified by:
getSchemaProperties
in interfaceMetadata
-
getSchemaOwner
public Optional<PrestoPrincipal> getSchemaOwner(Session session, CatalogSchemaName schemaName)
Description copied from interface:Metadata
Gets the schema owner for the specified schema.- Specified by:
getSchemaOwner
in interfaceMetadata
-
getView
public Optional<ConnectorViewDefinition> getView(Session session, QualifiedObjectName viewName)
Description copied from interface:Metadata
Returns the view definition for the specified view name.
-
createView
public void createView(Session session, QualifiedObjectName viewName, ConnectorViewDefinition definition, boolean replace)
Description copied from interface:Metadata
Creates the specified view with the specified view definition.- Specified by:
createView
in interfaceMetadata
-
renameView
public void renameView(Session session, QualifiedObjectName source, QualifiedObjectName target)
Description copied from interface:Metadata
Rename the specified view.- Specified by:
renameView
in interfaceMetadata
-
dropView
public void dropView(Session session, QualifiedObjectName viewName)
Description copied from interface:Metadata
Drops the specified view.
-
createMaterializedView
public void createMaterializedView(Session session, QualifiedObjectName viewName, ConnectorMaterializedViewDefinition definition, boolean replace, boolean ignoreExisting)
Description copied from interface:Metadata
Creates the specified materialized view with the specified view definition.- Specified by:
createMaterializedView
in interfaceMetadata
-
dropMaterializedView
public void dropMaterializedView(Session session, QualifiedObjectName viewName)
Description copied from interface:Metadata
Drops the specified materialized view.- Specified by:
dropMaterializedView
in interfaceMetadata
-
getMaterializedView
public Optional<ConnectorMaterializedViewDefinition> getMaterializedView(Session session, QualifiedObjectName viewName)
Description copied from interface:Metadata
Returns the materialized view definition for the specified view name.- Specified by:
getMaterializedView
in interfaceMetadata
-
getMaterializedViewFreshness
public MaterializedViewFreshness getMaterializedViewFreshness(Session session, TableHandle tableHandle)
Description copied from interface:Metadata
Method to get difference between the states of table at two different points in time/or as of given token-ids. The method is used by the engine to determine if a materialized view is current with respect to the tables it depends on.- Specified by:
getMaterializedViewFreshness
in interfaceMetadata
-
resolveIndex
public Optional<ResolvedIndex> resolveIndex(Session session, TableHandle tableHandle, Set<ColumnHandle> indexableColumns, Set<ColumnHandle> outputColumns, TupleDomain<ColumnHandle> tupleDomain)
Description copied from interface:Metadata
Try to locate a table index that can lookup results by indexableColumns and provide the requested outputColumns.- Specified by:
resolveIndex
in interfaceMetadata
-
usesLegacyTableLayouts
public boolean usesLegacyTableLayouts(Session session, TableHandle table)
- Specified by:
usesLegacyTableLayouts
in interfaceMetadata
-
applyLimit
public Optional<LimitApplicationResult<TableHandle>> applyLimit(Session session, TableHandle table, long limit)
- Specified by:
applyLimit
in interfaceMetadata
-
applySample
public Optional<TableHandle> applySample(Session session, TableHandle table, SampleType sampleType, double sampleRatio)
- Specified by:
applySample
in interfaceMetadata
-
applyAggregation
public Optional<AggregationApplicationResult<TableHandle>> applyAggregation(Session session, TableHandle table, List<AggregateFunction> aggregations, Map<String,ColumnHandle> assignments, List<List<ColumnHandle>> groupingSets)
- Specified by:
applyAggregation
in interfaceMetadata
-
applyTopN
public Optional<TopNApplicationResult<TableHandle>> applyTopN(Session session, TableHandle table, long topNCount, List<SortItem> sortItems, Map<String,ColumnHandle> assignments)
-
validateScan
public void validateScan(Session session, TableHandle table)
- Specified by:
validateScan
in interfaceMetadata
-
applyFilter
public Optional<ConstraintApplicationResult<TableHandle>> applyFilter(Session session, TableHandle table, Constraint constraint)
- Specified by:
applyFilter
in interfaceMetadata
-
applyProjection
public Optional<ProjectionApplicationResult<TableHandle>> applyProjection(Session session, TableHandle table, List<ConnectorExpression> projections, Map<String,ColumnHandle> assignments)
- Specified by:
applyProjection
in interfaceMetadata
-
createRole
public void createRole(Session session, String role, Optional<PrestoPrincipal> grantor, String catalog)
Description copied from interface:Metadata
Creates the specified role in the specified catalog.- Specified by:
createRole
in interfaceMetadata
grantor
- represents the principal specified by WITH ADMIN statement
-
dropRole
public void dropRole(Session session, String role, String catalog)
Description copied from interface:Metadata
Drops the specified role in the specified catalog.
-
listRoles
public Set<String> listRoles(Session session, String catalog)
Description copied from interface:Metadata
List available roles in specified catalog.
-
listAllRoleGrants
public Set<RoleGrant> listAllRoleGrants(Session session, String catalog, Optional<Set<String>> roles, Optional<Set<String>> grantees, OptionalLong limit)
Description copied from interface:Metadata
List all role grants in the specified catalog, optionally filtered by passed role, grantee, and limit predicates.- Specified by:
listAllRoleGrants
in interfaceMetadata
-
listRoleGrants
public Set<RoleGrant> listRoleGrants(Session session, String catalog, PrestoPrincipal principal)
Description copied from interface:Metadata
List roles grants in the specified catalog for a given principal, not recursively.- Specified by:
listRoleGrants
in interfaceMetadata
-
grantRoles
public void grantRoles(Session session, Set<String> roles, Set<PrestoPrincipal> grantees, boolean adminOption, Optional<PrestoPrincipal> grantor, String catalog)
Description copied from interface:Metadata
Grants the specified roles to the specified grantees in the specified catalog- Specified by:
grantRoles
in interfaceMetadata
grantor
- represents the principal specified by GRANTED BY statement
-
revokeRoles
public void revokeRoles(Session session, Set<String> roles, Set<PrestoPrincipal> grantees, boolean adminOption, Optional<PrestoPrincipal> grantor, String catalog)
Description copied from interface:Metadata
Revokes the specified roles from the specified grantees in the specified catalog- Specified by:
revokeRoles
in interfaceMetadata
grantor
- represents the principal specified by GRANTED BY statement
-
listApplicableRoles
public Set<RoleGrant> listApplicableRoles(Session session, PrestoPrincipal principal, String catalog)
Description copied from interface:Metadata
List applicable roles, including the transitive grants, for the specified principal- Specified by:
listApplicableRoles
in interfaceMetadata
-
listEnabledRoles
public Set<String> listEnabledRoles(Session session, String catalog)
Description copied from interface:Metadata
List applicable roles, including the transitive grants, in given session- Specified by:
listEnabledRoles
in interfaceMetadata
-
grantTablePrivileges
public void grantTablePrivileges(Session session, QualifiedObjectName tableName, Set<Privilege> privileges, PrestoPrincipal grantee, boolean grantOption)
Description copied from interface:Metadata
Grants the specified privilege to the specified user on the specified table- Specified by:
grantTablePrivileges
in interfaceMetadata
-
revokeTablePrivileges
public void revokeTablePrivileges(Session session, QualifiedObjectName tableName, Set<Privilege> privileges, PrestoPrincipal grantee, boolean grantOption)
Description copied from interface:Metadata
Revokes the specified privilege on the specified table from the specified user- Specified by:
revokeTablePrivileges
in interfaceMetadata
-
listTablePrivileges
public List<GrantInfo> listTablePrivileges(Session session, QualifiedTablePrefix prefix)
Description copied from interface:Metadata
Gets the privileges for the specified table available to the given grantee considering the selected session role- Specified by:
listTablePrivileges
in interfaceMetadata
-
getType
public Type getType(TypeSignature signature)
-
fromSqlType
public Type fromSqlType(String sqlType)
- Specified by:
fromSqlType
in interfaceMetadata
-
getTypes
public Collection<Type> getTypes()
-
getParametricTypes
public Collection<ParametricType> getParametricTypes()
- Specified by:
getParametricTypes
in interfaceMetadata
-
addType
public void addType(Type type)
-
addParametricType
public void addParametricType(ParametricType parametricType)
-
verifyTypes
public void verifyTypes()
- Specified by:
verifyTypes
in interfaceMetadata
-
addFunctions
public void addFunctions(List<? extends SqlFunction> functionInfos)
- Specified by:
addFunctions
in interfaceMetadata
-
listFunctions
public List<FunctionMetadata> listFunctions()
- Specified by:
listFunctions
in interfaceMetadata
-
decodeFunction
public ResolvedFunction decodeFunction(QualifiedName name)
- Specified by:
decodeFunction
in interfaceMetadata
-
resolveFunction
public ResolvedFunction resolveFunction(QualifiedName name, List<TypeSignatureProvider> parameterTypes)
- Specified by:
resolveFunction
in interfaceMetadata
-
resolveOperator
public ResolvedFunction resolveOperator(OperatorType operatorType, List<? extends Type> argumentTypes) throws OperatorNotFoundException
- Specified by:
resolveOperator
in interfaceMetadata
- Throws:
OperatorNotFoundException
-
getCoercion
public ResolvedFunction getCoercion(OperatorType operatorType, Type fromType, Type toType)
- Specified by:
getCoercion
in interfaceMetadata
-
getCoercion
public ResolvedFunction getCoercion(QualifiedName name, Type fromType, Type toType)
- Specified by:
getCoercion
in interfaceMetadata
-
resolve
public ResolvedFunction resolve(FunctionBinding functionBinding, FunctionDependencyDeclaration declaration)
-
isAggregationFunction
public boolean isAggregationFunction(QualifiedName name)
Description copied from interface:Metadata
Is the named function an aggregation function? This does not need type parameters because overloads between aggregation and other function types are not allowed.- Specified by:
isAggregationFunction
in interfaceMetadata
-
getFunctionMetadata
public FunctionMetadata getFunctionMetadata(ResolvedFunction resolvedFunction)
- Specified by:
getFunctionMetadata
in interfaceMetadata
-
getAggregationFunctionMetadata
public AggregationFunctionMetadata getAggregationFunctionMetadata(ResolvedFunction resolvedFunction)
- Specified by:
getAggregationFunctionMetadata
in interfaceMetadata
-
getWindowFunctionImplementation
public WindowFunctionSupplier getWindowFunctionImplementation(ResolvedFunction resolvedFunction)
- Specified by:
getWindowFunctionImplementation
in interfaceMetadata
-
getAggregateFunctionImplementation
public InternalAggregationFunction getAggregateFunctionImplementation(ResolvedFunction resolvedFunction)
- Specified by:
getAggregateFunctionImplementation
in interfaceMetadata
-
getScalarFunctionInvoker
public FunctionInvoker getScalarFunctionInvoker(ResolvedFunction resolvedFunction, Optional<InvocationConvention> invocationConvention)
- Specified by:
getScalarFunctionInvoker
in interfaceMetadata
-
toFunctionBinding
public static FunctionBinding toFunctionBinding(FunctionId functionId, BoundSignature boundSignature, Signature functionSignature)
-
getProcedureRegistry
public ProcedureRegistry getProcedureRegistry()
- Specified by:
getProcedureRegistry
in interfaceMetadata
-
getBlockEncoding
public BlockEncoding getBlockEncoding(String encodingName)
- Specified by:
getBlockEncoding
in interfaceMetadata
-
getBlockEncodingSerde
public BlockEncodingSerde getBlockEncodingSerde()
- Specified by:
getBlockEncodingSerde
in interfaceMetadata
-
addBlockEncoding
public void addBlockEncoding(BlockEncoding blockEncoding)
-
getSessionPropertyManager
public SessionPropertyManager getSessionPropertyManager()
- Specified by:
getSessionPropertyManager
in interfaceMetadata
-
getSchemaPropertyManager
public SchemaPropertyManager getSchemaPropertyManager()
- Specified by:
getSchemaPropertyManager
in interfaceMetadata
-
getTablePropertyManager
public TablePropertyManager getTablePropertyManager()
- Specified by:
getTablePropertyManager
in interfaceMetadata
-
getColumnPropertyManager
public ColumnPropertyManager getColumnPropertyManager()
- Specified by:
getColumnPropertyManager
in interfaceMetadata
-
getAnalyzePropertyManager
public AnalyzePropertyManager getAnalyzePropertyManager()
- Specified by:
getAnalyzePropertyManager
in interfaceMetadata
-
-