Package io.trino.metadata
Interface Metadata
-
- All Known Implementing Classes:
MetadataManager
public interface Metadata
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Deprecated Methods Modifier and Type Method Description voidaddColumn(Session session, TableHandle tableHandle, ColumnMetadata column)Add the specified column to the table.voidaddFunctions(List<? extends SqlFunction> functions)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 tableHandle)Push delete into connectorOptional<ConstraintApplicationResult<TableHandle>>applyFilter(Session session, TableHandle table, Constraint constraint)Optional<JoinApplicationResult<TableHandle>>applyJoin(Session session, JoinType joinType, TableHandle left, TableHandle right, List<JoinCondition> joinConditions, Map<String,ColumnHandle> leftAssignments, Map<String,ColumnHandle> rightAssignments, JoinStatistics statistics)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<SampleApplicationResult<TableHandle>>applySample(Session session, TableHandle table, SampleType sampleType, double sampleRatio)Optional<TableScanRedirectApplicationResult>applyTableScanRedirect(Session session, TableHandle tableHandle)Returns the result of redirecting the table scan on a given table to a different table.Optional<TopNApplicationResult<TableHandle>>applyTopN(Session session, TableHandle handle, long topNCount, List<SortItem> sortItems, Map<String,ColumnHandle> assignments)OutputTableHandlebeginCreateTable(Session session, String catalogName, ConnectorTableMetadata tableMetadata, Optional<NewTableLayout> layout)Begin the atomic creation of a table with data.TableHandlebeginDelete(Session session, TableHandle tableHandle)Begin delete queryInsertTableHandlebeginInsert(Session session, TableHandle tableHandle, List<ColumnHandle> columns)Begin insert queryInsertTableHandlebeginRefreshMaterializedView(Session session, TableHandle tableHandle, List<TableHandle> sourceTableHandles)Begin refresh materialized view queryAnalyzeTableHandlebeginStatisticsCollection(Session session, TableHandle tableHandle)Begin statistics collectionBeginTableExecuteResult<TableExecuteHandle,TableHandle>beginTableExecute(Session session, TableExecuteHandle handle, TableHandle updatedSourceTableHandle)TableHandlebeginUpdate(Session session, TableHandle tableHandle, List<ColumnHandle> updatedColumns)Begin update querybooleancatalogExists(Session session, String catalogName)voidcleanupQuery(Session session)Cleanup after a query.voidcreateMaterializedView(Session session, QualifiedObjectName viewName, MaterializedViewDefinition definition, boolean replace, boolean ignoreExisting)Creates the specified materialized view with the specified view definition.voidcreateRole(Session session, String role, Optional<TrinoPrincipal> grantor, Optional<String> catalog)Creates the specified role in the specified catalog.voidcreateSchema(Session session, CatalogSchemaName schema, Map<String,Object> properties, TrinoPrincipal principal)Creates a schema.voidcreateTable(Session session, String catalogName, ConnectorTableMetadata tableMetadata, boolean ignoreExisting)Creates a table using the specified table metadata.voidcreateView(Session session, QualifiedObjectName viewName, ViewDefinition definition, boolean replace)Creates the specified view with the specified view definition.ResolvedFunctiondecodeFunction(QualifiedName name)booleandelegateMaterializedViewRefreshToConnector(Session session, QualifiedObjectName viewName)Returns true if materialized view refresh should be delegated to connectorvoiddenySchemaPrivileges(Session session, CatalogSchemaName schemaName, Set<Privilege> privileges, TrinoPrincipal grantee)Deny the specified privilege to the specified principal on the specified schema.voiddenyTablePrivileges(Session session, QualifiedObjectName tableName, Set<Privilege> privileges, TrinoPrincipal grantee)Deny the specified privilege to the specified principal on the specified tablevoiddropColumn(Session session, TableHandle tableHandle, ColumnHandle column)Drop the specified column.voiddropMaterializedView(Session session, QualifiedObjectName viewName)Drops the specified materialized view.voiddropRole(Session session, String role, Optional<String> catalog)Drops the specified role in the specified catalog.voiddropSchema(Session session, CatalogSchemaName schema)Drops the specified schema.voiddropTable(Session session, TableHandle tableHandle)Drops the specified tablevoiddropView(Session session, QualifiedObjectName viewName)Drops the specified view.OptionalLongexecuteDelete(Session session, TableHandle tableHandle)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.voidfinishDelete(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, TableHandle tableHandle, InsertTableHandle insertTableHandle, Collection<io.airlift.slice.Slice> fragments, Collection<ComputedStatistics> computedStatistics, List<TableHandle> sourceTableHandles)Finish refresh materialized view queryvoidfinishStatisticsCollection(Session session, AnalyzeTableHandle tableHandle, Collection<ComputedStatistics> computedStatistics)Finish statistics collectionvoidfinishTableExecute(Session session, TableExecuteHandle handle, Collection<io.airlift.slice.Slice> fragments, List<Object> tableExecuteState)voidfinishUpdate(Session session, TableHandle tableHandle, Collection<io.airlift.slice.Slice> fragments)Finish update queryTypefromSqlType(String sqlType)InternalAggregationFunctiongetAggregateFunctionImplementation(ResolvedFunction resolvedFunction)AggregationFunctionMetadatagetAggregationFunctionMetadata(ResolvedFunction resolvedFunction)AnalyzePropertyManagergetAnalyzePropertyManager()BlockEncodingSerdegetBlockEncodingSerde()Optional<CatalogName>getCatalogHandle(Session session, String catalogName)Returns a connector id for the specified catalog name.Map<String,Catalog>getCatalogs(Session session)Gets all the loaded catalogsResolvedFunctiongetCoercion(Session session, OperatorType operatorType, Type fromType, Type toType)default ResolvedFunctiongetCoercion(Session session, Type fromType, Type toType)ResolvedFunctiongetCoercion(Session session, 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.ColumnMetadatagetColumnMetadata(Session session, TableHandle tableHandle, ColumnHandle columnHandle)Gets the metadata for the specified table column.ColumnPropertyManagergetColumnPropertyManager()Optional<PartitioningHandle>getCommonPartitioning(Session session, PartitioningHandle left, PartitioningHandle right)Return a partitioning handle which the connector can transparently convert bothleftandrightinto.Set<ConnectorCapabilities>getConnectorCapabilities(Session session, CatalogName catalogName)ColumnHandlegetDeleteRowIdColumnHandle(Session session, TableHandle tableHandle)Get the row ID column handle used with UpdatablePageSource#deleteRows.FunctionMetadatagetFunctionMetadata(ResolvedFunction resolvedFunction)Optional<Object>getInfo(Session session, TableHandle handle)Optional<NewTableLayout>getInsertLayout(Session session, TableHandle target)Optional<TableLayoutResult>getLayout(Session session, TableHandle tableHandle, Constraint constraint, Optional<Set<ColumnHandle>> desiredColumns)Deprecated.Optional<NewTableLayout>getLayoutForTableExecute(Session session, TableExecuteHandle tableExecuteHandle)Optional<MaterializedViewDefinition>getMaterializedView(Session session, QualifiedObjectName viewName)Returns the materialized view definition for the specified view name.MaterializedViewFreshnessgetMaterializedViewFreshness(Session session, QualifiedObjectName name)Method to get difference between the states of table at two different points in time/or as of given token-ids.MaterializedViewPropertyManagergetMaterializedViewPropertyManager()Map<QualifiedObjectName,ViewInfo>getMaterializedViews(Session session, QualifiedTablePrefix prefix)Get the materialized view definitions that match the specified table prefix (never null).Optional<NewTableLayout>getNewTableLayout(Session session, String catalogName, ConnectorTableMetadata tableMetadata)default TypegetParameterizedType(String baseTypeName, List<TypeSignatureParameter> typeParameters)Collection<ParametricType>getParametricTypes()ProcedureRegistrygetProcedureRegistry()RedirectionAwareTableHandlegetRedirectionAwareTableHandle(Session session, QualifiedObjectName tableName)Get the target table handle after performing redirection.RedirectionAwareTableHandlegetRedirectionAwareTableHandle(Session session, QualifiedObjectName tableName, Optional<TableVersion> startVersion, Optional<TableVersion> endVersion)Get the target table handle after performing redirection with a table version.FunctionInvokergetScalarFunctionInvoker(ResolvedFunction resolvedFunction, InvocationConvention invocationConvention)Optional<TrinoPrincipal>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.SchemaPropertyManagergetSchemaPropertyManager()SessionPropertyManagergetSessionPropertyManager()TableStatisticsMetadatagetStatisticsCollectionMetadata(Session session, String catalogName, ConnectorTableMetadata tableMetadata)Describe statistics that must be collected during a statistics collectionTableStatisticsMetadatagetStatisticsCollectionMetadataForWrite(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 tableName)Returns a table handle for the specified table name.Optional<TableHandle>getTableHandle(Session session, QualifiedObjectName tableName, Optional<TableVersion> startVersion, Optional<TableVersion> endVersion)Returns a table handle for the specified table name with a specified versionOptional<TableExecuteHandle>getTableHandleForExecute(Session session, TableHandle tableHandle, String procedureName, Map<String,Object> executeProperties)Optional<TableHandle>getTableHandleForStatisticsCollection(Session session, QualifiedObjectName tableName, Map<String,Object> analyzeProperties)TableMetadatagetTableMetadata(Session session, TableHandle tableHandle)Return the metadata for the specified table handle.TableProceduresRegistrygetTableProcedureRegistry()TableProceduresPropertyManagergetTableProceduresPropertyManager()TablePropertiesgetTableProperties(Session session, TableHandle handle)TablePropertyManagergetTablePropertyManager()TableSchemagetTableSchema(Session session, TableHandle tableHandle)Return table schema definition for the specified table handle.TableStatisticsgetTableStatistics(Session session, TableHandle tableHandle, Constraint constraint)Return statistics for specified table for given filtering contraint.TypegetType(TypeId id)TypegetType(TypeSignature signature)Collection<Type>getTypes()ColumnHandlegetUpdateRowIdColumnHandle(Session session, TableHandle tableHandle, List<ColumnHandle> updatedColumns)Get the row ID column handle used with UpdatablePageSource#updateRows.Optional<ViewDefinition>getView(Session session, QualifiedObjectName viewName)Returns the view definition for the specified view name.Map<QualifiedObjectName,ViewInfo>getViews(Session session, QualifiedTablePrefix prefix)Get the view definitions that match the specified table prefix (never null).WindowFunctionSuppliergetWindowFunctionImplementation(ResolvedFunction resolvedFunction)voidgrantRoles(Session session, Set<String> roles, Set<TrinoPrincipal> grantees, boolean adminOption, Optional<TrinoPrincipal> grantor, Optional<String> catalog)Grants the specified roles to the specified grantees in the specified catalogvoidgrantSchemaPrivileges(Session session, CatalogSchemaName schemaName, Set<Privilege> privileges, TrinoPrincipal grantee, boolean grantOption)Grants the specified privilege to the specified user on the specified schema.voidgrantTablePrivileges(Session session, QualifiedObjectName tableName, Set<Privilege> privileges, TrinoPrincipal grantee, boolean grantOption)Grants the specified privilege to the specified user on the specified tablebooleanisAggregationFunction(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.booleanisCatalogManagedSecurity(Session session, String catalog)Does the specified catalog manage security directly, or does it use system security management?default booleanisMaterializedView(Session session, QualifiedObjectName viewName)Is the specified table a materialized view.booleanisValidTableVersion(Session session, QualifiedObjectName tableName, TableVersion version)Verifies that a version is valid for a given tabledefault booleanisView(Session session, QualifiedObjectName viewName)Is the specified table a view.Set<RoleGrant>listAllRoleGrants(Session session, Optional<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, TrinoPrincipal principal, Optional<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 catalogSet<String>listEnabledRoles(Identity identity)List applicable system roles, including the transitive grants, for the given identity.List<FunctionMetadata>listFunctions()List<QualifiedObjectName>listMaterializedViews(Session session, QualifiedTablePrefix prefix)Get the names that match the specified table prefix (never null).Set<RoleGrant>listRoleGrants(Session session, Optional<String> catalog, TrinoPrincipal principal)List roles grants in the specified catalog for a given principal, not recursively.Set<String>listRoles(Session session, Optional<String> catalog)List available roles in specified catalog.List<String>listSchemaNames(Session session, String catalogName)Map<CatalogName,List<TableColumnsMetadata>>listTableColumns(Session session, QualifiedTablePrefix prefix)Gets the columns metadata for all tables that match the specified 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).TableHandlemakeCompatiblePartitioning(Session session, TableHandle table, PartitioningHandle partitioningHandle)Return a table handle whose partitioning is converted to the provided partitioning handle, but otherwise identical to the provided table handle.com.google.common.util.concurrent.ListenableFuture<Void>refreshMaterializedView(Session session, QualifiedObjectName viewName)Refresh materialized viewvoidrenameColumn(Session session, TableHandle tableHandle, ColumnHandle source, String target)Rename the specified column.voidrenameMaterializedView(Session session, QualifiedObjectName existingViewName, QualifiedObjectName newViewName)Rename the specified materialized view.voidrenameSchema(Session session, CatalogSchemaName source, String target)Renames the specified schema.voidrenameTable(Session session, TableHandle tableHandle, QualifiedObjectName newTableName)Rename the specified table.voidrenameView(Session session, QualifiedObjectName existingViewName, QualifiedObjectName newViewName)Rename the specified view.ResolvedFunctionresolveFunction(Session session, 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.ResolvedFunctionresolveOperator(Session session, OperatorType operatorType, List<? extends Type> argumentTypes)voidrevokeRoles(Session session, Set<String> roles, Set<TrinoPrincipal> grantees, boolean adminOption, Optional<TrinoPrincipal> grantor, Optional<String> catalog)Revokes the specified roles from the specified grantees in the specified catalogvoidrevokeSchemaPrivileges(Session session, CatalogSchemaName schemaName, Set<Privilege> privileges, TrinoPrincipal grantee, boolean grantOption)Revokes the specified privilege on the specified schema from the specified user.voidrevokeTablePrivileges(Session session, QualifiedObjectName tableName, Set<Privilege> privileges, TrinoPrincipal grantee, boolean grantOption)Revokes the specified privilege on the specified table from the specified userbooleanroleExists(Session session, String role, Optional<String> catalog)Does the specified role exist.booleanschemaExists(Session session, CatalogSchemaName schema)voidsetColumnComment(Session session, TableHandle tableHandle, ColumnHandle column, Optional<String> comment)Comments to the specified column.voidsetSchemaAuthorization(Session session, CatalogSchemaName source, TrinoPrincipal principal)Set the specified schema's user/role.voidsetTableAuthorization(Session session, CatalogSchemaTableName table, TrinoPrincipal principal)Set the authorization (owner) of specified table's user/rolevoidsetTableComment(Session session, TableHandle tableHandle, Optional<String> comment)Comments to the specified table.voidsetTableProperties(Session session, TableHandle tableHandle, Map<String,Object> properties)Set properties to the specified table.voidsetViewAuthorization(Session session, CatalogSchemaTableName view, TrinoPrincipal principal)Set the authorization (owner) of specified view's user/rolebooleansupportsMetadataDelete(Session session, TableHandle tableHandle)booleansupportsMissingColumnsOnInsert(Session session, TableHandle tableHandle)voidtruncateTable(Session session, TableHandle tableHandle)Truncates the specified tablebooleanusesLegacyTableLayouts(Session session, TableHandle table)Deprecated.default voidvalidateScan(Session session, TableHandle table)voidverifyTypes()
-
-
-
Method Detail
-
getConnectorCapabilities
Set<ConnectorCapabilities> getConnectorCapabilities(Session session, CatalogName catalogName)
-
schemaExists
boolean schemaExists(Session session, CatalogSchemaName schema)
-
getTableHandle
Optional<TableHandle> getTableHandle(Session session, QualifiedObjectName tableName)
Returns a table handle for the specified table name.
-
getSystemTable
Optional<SystemTable> getSystemTable(Session session, QualifiedObjectName tableName)
-
getTableHandleForStatisticsCollection
Optional<TableHandle> getTableHandleForStatisticsCollection(Session session, QualifiedObjectName tableName, Map<String,Object> analyzeProperties)
-
getTableHandleForExecute
Optional<TableExecuteHandle> getTableHandleForExecute(Session session, TableHandle tableHandle, String procedureName, Map<String,Object> executeProperties)
-
getLayoutForTableExecute
Optional<NewTableLayout> getLayoutForTableExecute(Session session, TableExecuteHandle tableExecuteHandle)
-
beginTableExecute
BeginTableExecuteResult<TableExecuteHandle,TableHandle> beginTableExecute(Session session, TableExecuteHandle handle, TableHandle updatedSourceTableHandle)
-
finishTableExecute
void finishTableExecute(Session session, TableExecuteHandle handle, Collection<io.airlift.slice.Slice> fragments, List<Object> tableExecuteState)
-
getLayout
@Deprecated Optional<TableLayoutResult> getLayout(Session session, TableHandle tableHandle, Constraint constraint, Optional<Set<ColumnHandle>> desiredColumns)
Deprecated.
-
getTableProperties
TableProperties getTableProperties(Session session, TableHandle handle)
-
makeCompatiblePartitioning
TableHandle makeCompatiblePartitioning(Session session, TableHandle table, PartitioningHandle partitioningHandle)
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 bygetCommonPartitioning(io.trino.Session, io.trino.sql.planner.PartitioningHandle, io.trino.sql.planner.PartitioningHandle).
-
getCommonPartitioning
Optional<PartitioningHandle> getCommonPartitioning(Session session, PartitioningHandle left, PartitioningHandle right)
Return a partitioning handle which the connector can transparently convert bothleftandrightinto.
-
getInfo
Optional<Object> getInfo(Session session, TableHandle handle)
-
getTableSchema
TableSchema getTableSchema(Session session, TableHandle tableHandle)
Return table schema definition for the specified table handle. Table schema definition is a set of information required by semantic analyzer to analyze the query.- Throws:
RuntimeException- if table handle is no longer valid
-
getTableMetadata
TableMetadata getTableMetadata(Session session, TableHandle tableHandle)
Return the metadata for the specified table handle.- Throws:
RuntimeException- if table handle is no longer valid
-
getTableStatistics
TableStatistics getTableStatistics(Session session, TableHandle tableHandle, Constraint constraint)
Return statistics for specified table for given filtering contraint.
-
listTables
List<QualifiedObjectName> listTables(Session session, QualifiedTablePrefix prefix)
Get the names that match the specified table prefix (never null).
-
getColumnHandles
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.- Throws:
RuntimeException- if table handle is no longer valid
-
getColumnMetadata
ColumnMetadata getColumnMetadata(Session session, TableHandle tableHandle, ColumnHandle columnHandle)
Gets the metadata for the specified table column.- Throws:
RuntimeException- if table or column handles are no longer valid
-
listTableColumns
Map<CatalogName,List<TableColumnsMetadata>> listTableColumns(Session session, QualifiedTablePrefix prefix)
Gets the columns metadata for all tables that match the specified prefix. TODO: consider returning a stream for more efficient processing
-
createSchema
void createSchema(Session session, CatalogSchemaName schema, Map<String,Object> properties, TrinoPrincipal principal)
Creates a schema.- Parameters:
principal- TODO
-
dropSchema
void dropSchema(Session session, CatalogSchemaName schema)
Drops the specified schema.
-
renameSchema
void renameSchema(Session session, CatalogSchemaName source, String target)
Renames the specified schema.
-
setSchemaAuthorization
void setSchemaAuthorization(Session session, CatalogSchemaName source, TrinoPrincipal principal)
Set the specified schema's user/role.
-
createTable
void createTable(Session session, String catalogName, ConnectorTableMetadata tableMetadata, boolean ignoreExisting)
Creates a table using the specified table metadata.- Throws:
TrinoException- withALREADY_EXISTSif the table already exists and {@param ignoreExisting} is not set
-
renameTable
void renameTable(Session session, TableHandle tableHandle, QualifiedObjectName newTableName)
Rename the specified table.
-
setTableProperties
void setTableProperties(Session session, TableHandle tableHandle, Map<String,Object> properties)
Set properties to the specified table.
-
setTableComment
void setTableComment(Session session, TableHandle tableHandle, Optional<String> comment)
Comments to the specified table.
-
setColumnComment
void setColumnComment(Session session, TableHandle tableHandle, ColumnHandle column, Optional<String> comment)
Comments to the specified column.
-
renameColumn
void renameColumn(Session session, TableHandle tableHandle, ColumnHandle source, String target)
Rename the specified column.
-
addColumn
void addColumn(Session session, TableHandle tableHandle, ColumnMetadata column)
Add the specified column to the table.
-
setTableAuthorization
void setTableAuthorization(Session session, CatalogSchemaTableName table, TrinoPrincipal principal)
Set the authorization (owner) of specified table's user/role
-
dropColumn
void dropColumn(Session session, TableHandle tableHandle, ColumnHandle column)
Drop the specified column.
-
dropTable
void dropTable(Session session, TableHandle tableHandle)
Drops the specified table- Throws:
RuntimeException- if the table cannot be dropped or table handle is no longer valid
-
truncateTable
void truncateTable(Session session, TableHandle tableHandle)
Truncates the specified table
-
getNewTableLayout
Optional<NewTableLayout> getNewTableLayout(Session session, String catalogName, ConnectorTableMetadata tableMetadata)
-
beginCreateTable
OutputTableHandle beginCreateTable(Session session, String catalogName, ConnectorTableMetadata tableMetadata, Optional<NewTableLayout> layout)
Begin the atomic creation of a table with data.
-
finishCreateTable
Optional<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.
-
getInsertLayout
Optional<NewTableLayout> getInsertLayout(Session session, TableHandle target)
-
getStatisticsCollectionMetadataForWrite
TableStatisticsMetadata getStatisticsCollectionMetadataForWrite(Session session, String catalogName, ConnectorTableMetadata tableMetadata)
Describes statistics that must be collected during a write.
-
getStatisticsCollectionMetadata
TableStatisticsMetadata getStatisticsCollectionMetadata(Session session, String catalogName, ConnectorTableMetadata tableMetadata)
Describe statistics that must be collected during a statistics collection
-
beginStatisticsCollection
AnalyzeTableHandle beginStatisticsCollection(Session session, TableHandle tableHandle)
Begin statistics collection
-
finishStatisticsCollection
void finishStatisticsCollection(Session session, AnalyzeTableHandle tableHandle, Collection<ComputedStatistics> computedStatistics)
Finish statistics collection
-
cleanupQuery
void cleanupQuery(Session session)
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.
-
beginInsert
InsertTableHandle beginInsert(Session session, TableHandle tableHandle, List<ColumnHandle> columns)
Begin insert query
-
supportsMissingColumnsOnInsert
boolean supportsMissingColumnsOnInsert(Session session, TableHandle tableHandle)
- Returns:
- whether connector handles missing columns during insert
-
finishInsert
Optional<ConnectorOutputMetadata> finishInsert(Session session, InsertTableHandle tableHandle, Collection<io.airlift.slice.Slice> fragments, Collection<ComputedStatistics> computedStatistics)
Finish insert query
-
delegateMaterializedViewRefreshToConnector
boolean delegateMaterializedViewRefreshToConnector(Session session, QualifiedObjectName viewName)
Returns true if materialized view refresh should be delegated to connector
-
refreshMaterializedView
com.google.common.util.concurrent.ListenableFuture<Void> refreshMaterializedView(Session session, QualifiedObjectName viewName)
Refresh materialized view
-
beginRefreshMaterializedView
InsertTableHandle beginRefreshMaterializedView(Session session, TableHandle tableHandle, List<TableHandle> sourceTableHandles)
Begin refresh materialized view query
-
finishRefreshMaterializedView
Optional<ConnectorOutputMetadata> finishRefreshMaterializedView(Session session, TableHandle tableHandle, InsertTableHandle insertTableHandle, Collection<io.airlift.slice.Slice> fragments, Collection<ComputedStatistics> computedStatistics, List<TableHandle> sourceTableHandles)
Finish refresh materialized view query
-
getDeleteRowIdColumnHandle
ColumnHandle getDeleteRowIdColumnHandle(Session session, TableHandle tableHandle)
Get the row ID column handle used with UpdatablePageSource#deleteRows.
-
getUpdateRowIdColumnHandle
ColumnHandle getUpdateRowIdColumnHandle(Session session, TableHandle tableHandle, List<ColumnHandle> updatedColumns)
Get the row ID column handle used with UpdatablePageSource#updateRows.
-
supportsMetadataDelete
boolean supportsMetadataDelete(Session session, TableHandle tableHandle)
- Returns:
- whether delete without table scan is supported
-
applyDelete
Optional<TableHandle> applyDelete(Session session, TableHandle tableHandle)
Push delete into connector
-
executeDelete
OptionalLong executeDelete(Session session, TableHandle tableHandle)
Execute delete in connector
-
beginDelete
TableHandle beginDelete(Session session, TableHandle tableHandle)
Begin delete query
-
finishDelete
void finishDelete(Session session, TableHandle tableHandle, Collection<io.airlift.slice.Slice> fragments)
Finish delete query
-
beginUpdate
TableHandle beginUpdate(Session session, TableHandle tableHandle, List<ColumnHandle> updatedColumns)
Begin update query
-
finishUpdate
void finishUpdate(Session session, TableHandle tableHandle, Collection<io.airlift.slice.Slice> fragments)
Finish update query
-
getCatalogHandle
Optional<CatalogName> getCatalogHandle(Session session, String catalogName)
Returns a connector id for the specified catalog name.
-
getCatalogs
Map<String,Catalog> getCatalogs(Session session)
Gets all the loaded catalogs- Returns:
- Map of catalog name to connector
-
listViews
List<QualifiedObjectName> listViews(Session session, QualifiedTablePrefix prefix)
Get the names that match the specified table prefix (never null).
-
getViews
Map<QualifiedObjectName,ViewInfo> getViews(Session session, QualifiedTablePrefix prefix)
Get the view definitions that match the specified table prefix (never null).
-
isView
default boolean isView(Session session, QualifiedObjectName viewName)
Is the specified table a view.
-
getView
Optional<ViewDefinition> getView(Session session, QualifiedObjectName viewName)
Returns the view definition for the specified view name.
-
getSchemaProperties
Map<String,Object> getSchemaProperties(Session session, CatalogSchemaName schemaName)
Gets the schema properties for the specified schema.
-
getSchemaOwner
Optional<TrinoPrincipal> getSchemaOwner(Session session, CatalogSchemaName schemaName)
Gets the schema owner for the specified schema.
-
createView
void createView(Session session, QualifiedObjectName viewName, ViewDefinition definition, boolean replace)
Creates the specified view with the specified view definition.
-
renameView
void renameView(Session session, QualifiedObjectName existingViewName, QualifiedObjectName newViewName)
Rename the specified view.
-
setViewAuthorization
void setViewAuthorization(Session session, CatalogSchemaTableName view, TrinoPrincipal principal)
Set the authorization (owner) of specified view's user/role
-
dropView
void dropView(Session session, QualifiedObjectName viewName)
Drops the specified view.
-
resolveIndex
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.
-
usesLegacyTableLayouts
@Deprecated boolean usesLegacyTableLayouts(Session session, TableHandle table)
Deprecated.
-
applyLimit
Optional<LimitApplicationResult<TableHandle>> applyLimit(Session session, TableHandle table, long limit)
-
applyFilter
Optional<ConstraintApplicationResult<TableHandle>> applyFilter(Session session, TableHandle table, Constraint constraint)
-
applyProjection
Optional<ProjectionApplicationResult<TableHandle>> applyProjection(Session session, TableHandle table, List<ConnectorExpression> projections, Map<String,ColumnHandle> assignments)
-
applySample
Optional<SampleApplicationResult<TableHandle>> applySample(Session session, TableHandle table, SampleType sampleType, double sampleRatio)
-
applyAggregation
Optional<AggregationApplicationResult<TableHandle>> applyAggregation(Session session, TableHandle table, List<AggregateFunction> aggregations, Map<String,ColumnHandle> assignments, List<List<ColumnHandle>> groupingSets)
-
applyJoin
Optional<JoinApplicationResult<TableHandle>> applyJoin(Session session, JoinType joinType, TableHandle left, TableHandle right, List<JoinCondition> joinConditions, Map<String,ColumnHandle> leftAssignments, Map<String,ColumnHandle> rightAssignments, JoinStatistics statistics)
-
applyTopN
Optional<TopNApplicationResult<TableHandle>> applyTopN(Session session, TableHandle handle, long topNCount, List<SortItem> sortItems, Map<String,ColumnHandle> assignments)
-
validateScan
default void validateScan(Session session, TableHandle table)
-
isCatalogManagedSecurity
boolean isCatalogManagedSecurity(Session session, String catalog)
Does the specified catalog manage security directly, or does it use system security management?
-
roleExists
boolean roleExists(Session session, String role, Optional<String> catalog)
Does the specified role exist.- Parameters:
catalog- if present, the role catalog; otherwise the role is a system role
-
createRole
void createRole(Session session, String role, Optional<TrinoPrincipal> grantor, Optional<String> catalog)
Creates the specified role in the specified catalog.- Parameters:
grantor- represents the principal specified by WITH ADMIN statementcatalog- if present, the role catalog; otherwise the role is a system role
-
dropRole
void dropRole(Session session, String role, Optional<String> catalog)
Drops the specified role in the specified catalog.- Parameters:
catalog- if present, the role catalog; otherwise the role is a system role
-
listRoles
Set<String> listRoles(Session session, Optional<String> catalog)
List available roles in specified catalog.- Parameters:
catalog- if present, the role catalog; otherwise the role is a system role
-
listAllRoleGrants
Set<RoleGrant> listAllRoleGrants(Session session, Optional<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.- Parameters:
catalog- if present, the role catalog; otherwise the role is a system role
-
listRoleGrants
Set<RoleGrant> listRoleGrants(Session session, Optional<String> catalog, TrinoPrincipal principal)
List roles grants in the specified catalog for a given principal, not recursively.- Parameters:
catalog- if present, the role catalog; otherwise the role is a system role
-
grantRoles
void grantRoles(Session session, Set<String> roles, Set<TrinoPrincipal> grantees, boolean adminOption, Optional<TrinoPrincipal> grantor, Optional<String> catalog)
Grants the specified roles to the specified grantees in the specified catalog- Parameters:
grantor- represents the principal specified by GRANTED BY statementcatalog- if present, the role catalog; otherwise the role is a system role
-
revokeRoles
void revokeRoles(Session session, Set<String> roles, Set<TrinoPrincipal> grantees, boolean adminOption, Optional<TrinoPrincipal> grantor, Optional<String> catalog)
Revokes the specified roles from the specified grantees in the specified catalog- Parameters:
grantor- represents the principal specified by GRANTED BY statementcatalog- if present, the role catalog; otherwise the role is a system role
-
listApplicableRoles
Set<RoleGrant> listApplicableRoles(Session session, TrinoPrincipal principal, Optional<String> catalog)
List applicable roles, including the transitive grants, for the specified principal- Parameters:
catalog- if present, the role catalog; otherwise the role is a system role
-
listEnabledRoles
Set<String> listEnabledRoles(Identity identity)
List applicable system roles, including the transitive grants, for the given identity.
-
listEnabledRoles
Set<String> listEnabledRoles(Session session, String catalog)
List applicable roles, including the transitive grants, in given catalog- Parameters:
catalog- if present, the role catalog; otherwise the role is a system role
-
grantSchemaPrivileges
void grantSchemaPrivileges(Session session, CatalogSchemaName schemaName, Set<Privilege> privileges, TrinoPrincipal grantee, boolean grantOption)
Grants the specified privilege to the specified user on the specified schema.
-
denySchemaPrivileges
void denySchemaPrivileges(Session session, CatalogSchemaName schemaName, Set<Privilege> privileges, TrinoPrincipal grantee)
Deny the specified privilege to the specified principal on the specified schema.
-
revokeSchemaPrivileges
void revokeSchemaPrivileges(Session session, CatalogSchemaName schemaName, Set<Privilege> privileges, TrinoPrincipal grantee, boolean grantOption)
Revokes the specified privilege on the specified schema from the specified user.
-
grantTablePrivileges
void grantTablePrivileges(Session session, QualifiedObjectName tableName, Set<Privilege> privileges, TrinoPrincipal grantee, boolean grantOption)
Grants the specified privilege to the specified user on the specified table
-
denyTablePrivileges
void denyTablePrivileges(Session session, QualifiedObjectName tableName, Set<Privilege> privileges, TrinoPrincipal grantee)
Deny the specified privilege to the specified principal on the specified table
-
revokeTablePrivileges
void revokeTablePrivileges(Session session, QualifiedObjectName tableName, Set<Privilege> privileges, TrinoPrincipal grantee, boolean grantOption)
Revokes the specified privilege on the specified table from the specified user
-
listTablePrivileges
List<GrantInfo> listTablePrivileges(Session session, QualifiedTablePrefix prefix)
Gets the privileges for the specified table available to the given grantee considering the selected session role
-
getType
Type getType(TypeSignature signature)
-
getParameterizedType
default Type getParameterizedType(String baseTypeName, List<TypeSignatureParameter> typeParameters)
-
getTypes
Collection<Type> getTypes()
-
getParametricTypes
Collection<ParametricType> getParametricTypes()
-
verifyTypes
void verifyTypes()
-
addFunctions
void addFunctions(List<? extends SqlFunction> functions)
-
listFunctions
List<FunctionMetadata> listFunctions()
-
decodeFunction
ResolvedFunction decodeFunction(QualifiedName name)
-
resolveFunction
ResolvedFunction resolveFunction(Session session, QualifiedName name, List<TypeSignatureProvider> parameterTypes)
-
resolveOperator
ResolvedFunction resolveOperator(Session session, OperatorType operatorType, List<? extends Type> argumentTypes) throws OperatorNotFoundException
- Throws:
OperatorNotFoundException
-
getCoercion
default ResolvedFunction getCoercion(Session session, Type fromType, Type toType)
-
getCoercion
ResolvedFunction getCoercion(Session session, OperatorType operatorType, Type fromType, Type toType)
-
getCoercion
ResolvedFunction getCoercion(Session session, QualifiedName name, Type fromType, Type toType)
-
isAggregationFunction
boolean 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.
-
getFunctionMetadata
FunctionMetadata getFunctionMetadata(ResolvedFunction resolvedFunction)
-
getAggregationFunctionMetadata
AggregationFunctionMetadata getAggregationFunctionMetadata(ResolvedFunction resolvedFunction)
-
getWindowFunctionImplementation
WindowFunctionSupplier getWindowFunctionImplementation(ResolvedFunction resolvedFunction)
-
getAggregateFunctionImplementation
InternalAggregationFunction getAggregateFunctionImplementation(ResolvedFunction resolvedFunction)
-
getScalarFunctionInvoker
FunctionInvoker getScalarFunctionInvoker(ResolvedFunction resolvedFunction, InvocationConvention invocationConvention)
-
getProcedureRegistry
ProcedureRegistry getProcedureRegistry()
-
getTableProcedureRegistry
TableProceduresRegistry getTableProcedureRegistry()
-
getBlockEncodingSerde
BlockEncodingSerde getBlockEncodingSerde()
-
getSessionPropertyManager
SessionPropertyManager getSessionPropertyManager()
-
getSchemaPropertyManager
SchemaPropertyManager getSchemaPropertyManager()
-
getTablePropertyManager
TablePropertyManager getTablePropertyManager()
-
getMaterializedViewPropertyManager
MaterializedViewPropertyManager getMaterializedViewPropertyManager()
-
getColumnPropertyManager
ColumnPropertyManager getColumnPropertyManager()
-
getAnalyzePropertyManager
AnalyzePropertyManager getAnalyzePropertyManager()
-
getTableProceduresPropertyManager
TableProceduresPropertyManager getTableProceduresPropertyManager()
-
createMaterializedView
void createMaterializedView(Session session, QualifiedObjectName viewName, MaterializedViewDefinition definition, boolean replace, boolean ignoreExisting)
Creates the specified materialized view with the specified view definition.
-
dropMaterializedView
void dropMaterializedView(Session session, QualifiedObjectName viewName)
Drops the specified materialized view.
-
listMaterializedViews
List<QualifiedObjectName> listMaterializedViews(Session session, QualifiedTablePrefix prefix)
Get the names that match the specified table prefix (never null).
-
getMaterializedViews
Map<QualifiedObjectName,ViewInfo> getMaterializedViews(Session session, QualifiedTablePrefix prefix)
Get the materialized view definitions that match the specified table prefix (never null).
-
isMaterializedView
default boolean isMaterializedView(Session session, QualifiedObjectName viewName)
Is the specified table a materialized view.
-
getMaterializedView
Optional<MaterializedViewDefinition> getMaterializedView(Session session, QualifiedObjectName viewName)
Returns the materialized view definition for the specified view name.
-
getMaterializedViewFreshness
MaterializedViewFreshness getMaterializedViewFreshness(Session session, QualifiedObjectName name)
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.
-
renameMaterializedView
void renameMaterializedView(Session session, QualifiedObjectName existingViewName, QualifiedObjectName newViewName)
Rename the specified materialized view.
-
applyTableScanRedirect
Optional<TableScanRedirectApplicationResult> applyTableScanRedirect(Session session, TableHandle tableHandle)
Returns the result of redirecting the table scan on a given table to a different table. This method is used by the engine during the plan optimization phase to allow a connector to offload table scans to any other connector. This method is called after security checks against the original table.
-
getRedirectionAwareTableHandle
RedirectionAwareTableHandle getRedirectionAwareTableHandle(Session session, QualifiedObjectName tableName)
Get the target table handle after performing redirection.
-
getRedirectionAwareTableHandle
RedirectionAwareTableHandle getRedirectionAwareTableHandle(Session session, QualifiedObjectName tableName, Optional<TableVersion> startVersion, Optional<TableVersion> endVersion)
Get the target table handle after performing redirection with a table version.
-
isValidTableVersion
boolean isValidTableVersion(Session session, QualifiedObjectName tableName, TableVersion version)
Verifies that a version is valid for a given table
-
getTableHandle
Optional<TableHandle> getTableHandle(Session session, QualifiedObjectName tableName, Optional<TableVersion> startVersion, Optional<TableVersion> endVersion)
Returns a table handle for the specified table name with a specified version
-
-