Package io.trino.plugin.jdbc
Class DefaultJdbcMetadata
- java.lang.Object
-
- io.trino.plugin.jdbc.DefaultJdbcMetadata
-
- All Implemented Interfaces:
JdbcMetadata,ConnectorMetadata
public class DefaultJdbcMetadata extends Object implements JdbcMetadata
-
-
Constructor Summary
Constructors Constructor Description DefaultJdbcMetadata(JdbcClient jdbcClient, boolean allowDropTable)
-
Method Summary
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface io.trino.spi.connector.ConnectorMetadata
applyDelete, applySample, beginDelete, beginInsert, beginQuery, beginRefreshMaterializedView, beginStatisticsCollection, beginUpdate, cleanupQuery, createMaterializedView, createRole, createView, delegateMaterializedViewRefreshToConnector, dropMaterializedView, dropRole, dropView, executeDelete, finishDelete, finishRefreshMaterializedView, finishStatisticsCollection, finishUpdate, getCommonPartitioningHandle, getDeleteRowIdColumnHandle, getInfo, getInfo, getInsertLayout, getMaterializedView, getMaterializedViewFreshness, getMaterializedViews, getNewTableLayout, getSchemaOwner, getSchemaProperties, getStatisticsCollectionMetadata, getStatisticsCollectionMetadataForWrite, getTableHandleForStatisticsCollection, getTableLayout, getTableLayouts, getUpdateRowIdColumnHandle, getView, getViews, grantRoles, grantSchemaPrivileges, grantTablePrivileges, listAllRoleGrants, listApplicableRoles, listEnabledRoles, listMaterializedViews, listRoleGrants, listRoles, listTablePrivileges, listViews, makeCompatiblePartitioning, makeCompatiblePartitioning, metadataDelete, redirectTable, refreshMaterializedView, renameSchema, renameView, resolveIndex, revokeRoles, revokeSchemaPrivileges, revokeTablePrivileges, setSchemaAuthorization, setTableAuthorization, setTableComment, setViewAuthorization, streamTableColumns, supportsMetadataDelete, validateScan
-
-
-
-
Constructor Detail
-
DefaultJdbcMetadata
public DefaultJdbcMetadata(JdbcClient jdbcClient, boolean allowDropTable)
-
-
Method Detail
-
schemaExists
public boolean schemaExists(ConnectorSession session, String schemaName)
- Specified by:
schemaExistsin interfaceConnectorMetadata
-
listSchemaNames
public List<String> listSchemaNames(ConnectorSession session)
- Specified by:
listSchemaNamesin interfaceConnectorMetadata
-
getTableHandle
public JdbcTableHandle getTableHandle(ConnectorSession session, SchemaTableName tableName)
- Specified by:
getTableHandlein interfaceConnectorMetadata
-
getSystemTable
public Optional<SystemTable> getSystemTable(ConnectorSession session, SchemaTableName tableName)
- Specified by:
getSystemTablein interfaceConnectorMetadata
-
applyFilter
public Optional<ConstraintApplicationResult<ConnectorTableHandle>> applyFilter(ConnectorSession session, ConnectorTableHandle table, Constraint constraint)
- Specified by:
applyFilterin interfaceConnectorMetadata
-
applyProjection
public Optional<ProjectionApplicationResult<ConnectorTableHandle>> applyProjection(ConnectorSession session, ConnectorTableHandle table, List<ConnectorExpression> projections, Map<String,ColumnHandle> assignments)
- Specified by:
applyProjectionin interfaceConnectorMetadata
-
applyAggregation
public Optional<AggregationApplicationResult<ConnectorTableHandle>> applyAggregation(ConnectorSession session, ConnectorTableHandle table, List<AggregateFunction> aggregates, Map<String,ColumnHandle> assignments, List<List<ColumnHandle>> groupingSets)
- Specified by:
applyAggregationin interfaceConnectorMetadata
-
applyJoin
public Optional<JoinApplicationResult<ConnectorTableHandle>> applyJoin(ConnectorSession session, JoinType joinType, ConnectorTableHandle left, ConnectorTableHandle right, List<JoinCondition> joinConditions, Map<String,ColumnHandle> leftAssignments, Map<String,ColumnHandle> rightAssignments, JoinStatistics statistics)
- Specified by:
applyJoinin interfaceConnectorMetadata
-
applyLimit
public Optional<LimitApplicationResult<ConnectorTableHandle>> applyLimit(ConnectorSession session, ConnectorTableHandle table, long limit)
- Specified by:
applyLimitin interfaceConnectorMetadata
-
applyTopN
public Optional<TopNApplicationResult<ConnectorTableHandle>> applyTopN(ConnectorSession session, ConnectorTableHandle table, long topNCount, List<SortItem> sortItems, Map<String,ColumnHandle> assignments)
- Specified by:
applyTopNin interfaceConnectorMetadata
-
applyTableScanRedirect
public Optional<TableScanRedirectApplicationResult> applyTableScanRedirect(ConnectorSession session, ConnectorTableHandle table)
- Specified by:
applyTableScanRedirectin interfaceConnectorMetadata
-
usesLegacyTableLayouts
public boolean usesLegacyTableLayouts()
- Specified by:
usesLegacyTableLayoutsin interfaceConnectorMetadata
-
getTableProperties
public ConnectorTableProperties getTableProperties(ConnectorSession session, ConnectorTableHandle table)
- Specified by:
getTablePropertiesin interfaceConnectorMetadata
-
getTableSchema
public ConnectorTableSchema getTableSchema(ConnectorSession session, ConnectorTableHandle table)
- Specified by:
getTableSchemain interfaceConnectorMetadata
-
getTableMetadata
public ConnectorTableMetadata getTableMetadata(ConnectorSession session, ConnectorTableHandle table)
- Specified by:
getTableMetadatain interfaceConnectorMetadata
-
getSchemaTableName
public static SchemaTableName getSchemaTableName(JdbcTableHandle handle)
-
listTables
public List<SchemaTableName> listTables(ConnectorSession session, Optional<String> schemaName)
- Specified by:
listTablesin interfaceConnectorMetadata
-
getColumnHandles
public Map<String,ColumnHandle> getColumnHandles(ConnectorSession session, ConnectorTableHandle tableHandle)
- Specified by:
getColumnHandlesin interfaceConnectorMetadata
-
listTableColumns
public Map<SchemaTableName,List<ColumnMetadata>> listTableColumns(ConnectorSession session, SchemaTablePrefix prefix)
- Specified by:
listTableColumnsin interfaceConnectorMetadata
-
getColumnMetadata
public ColumnMetadata getColumnMetadata(ConnectorSession session, ConnectorTableHandle tableHandle, ColumnHandle columnHandle)
- Specified by:
getColumnMetadatain interfaceConnectorMetadata
-
dropTable
public void dropTable(ConnectorSession session, ConnectorTableHandle tableHandle)
- Specified by:
dropTablein interfaceConnectorMetadata
-
beginCreateTable
public ConnectorOutputTableHandle beginCreateTable(ConnectorSession session, ConnectorTableMetadata tableMetadata, Optional<ConnectorNewTableLayout> layout)
- Specified by:
beginCreateTablein interfaceConnectorMetadata
-
createTable
public void createTable(ConnectorSession session, ConnectorTableMetadata tableMetadata, boolean ignoreExisting)
- Specified by:
createTablein interfaceConnectorMetadata
-
finishCreateTable
public Optional<ConnectorOutputMetadata> finishCreateTable(ConnectorSession session, ConnectorOutputTableHandle tableHandle, Collection<io.airlift.slice.Slice> fragments, Collection<ComputedStatistics> computedStatistics)
- Specified by:
finishCreateTablein interfaceConnectorMetadata
-
rollback
public void rollback()
- Specified by:
rollbackin interfaceJdbcMetadata
-
beginInsert
public ConnectorInsertTableHandle beginInsert(ConnectorSession session, ConnectorTableHandle tableHandle, List<ColumnHandle> columns)
- Specified by:
beginInsertin interfaceConnectorMetadata
-
supportsMissingColumnsOnInsert
public boolean supportsMissingColumnsOnInsert()
- Specified by:
supportsMissingColumnsOnInsertin interfaceConnectorMetadata
-
finishInsert
public Optional<ConnectorOutputMetadata> finishInsert(ConnectorSession session, ConnectorInsertTableHandle tableHandle, Collection<io.airlift.slice.Slice> fragments, Collection<ComputedStatistics> computedStatistics)
- Specified by:
finishInsertin interfaceConnectorMetadata
-
setColumnComment
public void setColumnComment(ConnectorSession session, ConnectorTableHandle table, ColumnHandle column, Optional<String> comment)
- Specified by:
setColumnCommentin interfaceConnectorMetadata
-
addColumn
public void addColumn(ConnectorSession session, ConnectorTableHandle table, ColumnMetadata columnMetadata)
- Specified by:
addColumnin interfaceConnectorMetadata
-
dropColumn
public void dropColumn(ConnectorSession session, ConnectorTableHandle table, ColumnHandle column)
- Specified by:
dropColumnin interfaceConnectorMetadata
-
renameColumn
public void renameColumn(ConnectorSession session, ConnectorTableHandle table, ColumnHandle column, String target)
- Specified by:
renameColumnin interfaceConnectorMetadata
-
renameTable
public void renameTable(ConnectorSession session, ConnectorTableHandle table, SchemaTableName newTableName)
- Specified by:
renameTablein interfaceConnectorMetadata
-
getTableStatistics
public TableStatistics getTableStatistics(ConnectorSession session, ConnectorTableHandle tableHandle, Constraint constraint)
- Specified by:
getTableStatisticsin interfaceConnectorMetadata
-
createSchema
public void createSchema(ConnectorSession session, String schemaName, Map<String,Object> properties, TrinoPrincipal owner)
- Specified by:
createSchemain interfaceConnectorMetadata
-
dropSchema
public void dropSchema(ConnectorSession session, String schemaName)
- Specified by:
dropSchemain interfaceConnectorMetadata
-
-