Package io.trino.plugin.deltalake
Class DeltaLakeMetadata
- java.lang.Object
-
- io.trino.plugin.deltalake.DeltaLakeMetadata
-
- All Implemented Interfaces:
ConnectorMetadata
public class DeltaLakeMetadata extends Object implements ConnectorMetadata
-
-
Field Summary
Fields Modifier and Type Field Description static StringADD_COLUMN_OPERATIONstatic StringCREATE_TABLE_AS_OPERATIONstatic StringCREATE_TABLE_OPERATIONstatic StringDELETE_OPERATIONstatic StorageFormatDELTA_STORAGE_FORMATstatic StringINSERT_OPERATIONstatic StringISOLATION_LEVELstatic io.airlift.log.LoggerLOGstatic StringOPTIMIZE_OPERATIONstatic StringPATH_PROPERTYstatic StringUPDATE_OPERATION
-
Constructor Summary
Constructors Constructor Description DeltaLakeMetadata(DeltaLakeMetastore metastore, HdfsEnvironment hdfsEnvironment, TypeManager typeManager, AccessControlMetadata accessControlMetadata, int domainCompactionThreshold, boolean unsafeWritesEnabled, io.airlift.json.JsonCodec<DataFileInfo> dataFileInfoCodec, io.airlift.json.JsonCodec<DeltaLakeUpdateResult> updateResultJsonCodec, TransactionLogWriterFactory transactionLogWriterFactory, NodeManager nodeManager, CheckpointWriterManager checkpointWriterManager, long defaultCheckpointInterval, boolean ignoreCheckpointWriteFailures, boolean deleteSchemaLocationsFallback, DeltaLakeRedirectionsProvider deltaLakeRedirectionsProvider, ExtendedStatisticsAccess statisticsAccess)
-
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
applyAggregation, applyDelete, applyJoin, applyLimit, applySample, applyTableFunction, applyTopN, beginQuery, beginRefreshMaterializedView, cleanupQuery, createMaterializedView, createView, delegateMaterializedViewRefreshToConnector, denySchemaPrivileges, denyTablePrivileges, dropColumn, dropMaterializedView, dropView, executeDelete, executeTableExecute, finishRefreshMaterializedView, getCommonPartitioningHandle, getInfo, getMaterializedView, getMaterializedViewFreshness, getMaterializedViews, getSchemaOwner, getStatisticsCollectionMetadataForWrite, getSystemTable, getTableHandle, getTableSchema, getTableStatistics, getView, getViews, grantSchemaPrivileges, isSupportedVersionType, listAllRoleGrants, listMaterializedViews, listViews, makeCompatiblePartitioning, refreshMaterializedView, renameColumn, renameMaterializedView, renameSchema, renameTable, renameView, resolveIndex, revokeSchemaPrivileges, roleExists, schemaExists, setColumnComment, setMaterializedViewProperties, setSchemaAuthorization, setTableAuthorization, setTableComment, setTableProperties, setViewAuthorization, supportsMissingColumnsOnInsert, truncateTable, validateScan
-
-
-
-
Field Detail
-
LOG
public static final io.airlift.log.Logger LOG
-
PATH_PROPERTY
public static final String PATH_PROPERTY
- See Also:
- Constant Field Values
-
DELTA_STORAGE_FORMAT
public static final StorageFormat DELTA_STORAGE_FORMAT
-
CREATE_TABLE_AS_OPERATION
public static final String CREATE_TABLE_AS_OPERATION
- See Also:
- Constant Field Values
-
CREATE_TABLE_OPERATION
public static final String CREATE_TABLE_OPERATION
- See Also:
- Constant Field Values
-
ADD_COLUMN_OPERATION
public static final String ADD_COLUMN_OPERATION
- See Also:
- Constant Field Values
-
INSERT_OPERATION
public static final String INSERT_OPERATION
- See Also:
- Constant Field Values
-
DELETE_OPERATION
public static final String DELETE_OPERATION
- See Also:
- Constant Field Values
-
UPDATE_OPERATION
public static final String UPDATE_OPERATION
- See Also:
- Constant Field Values
-
OPTIMIZE_OPERATION
public static final String OPTIMIZE_OPERATION
- See Also:
- Constant Field Values
-
ISOLATION_LEVEL
public static final String ISOLATION_LEVEL
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
DeltaLakeMetadata
public DeltaLakeMetadata(DeltaLakeMetastore metastore, HdfsEnvironment hdfsEnvironment, TypeManager typeManager, AccessControlMetadata accessControlMetadata, int domainCompactionThreshold, boolean unsafeWritesEnabled, io.airlift.json.JsonCodec<DataFileInfo> dataFileInfoCodec, io.airlift.json.JsonCodec<DeltaLakeUpdateResult> updateResultJsonCodec, TransactionLogWriterFactory transactionLogWriterFactory, NodeManager nodeManager, CheckpointWriterManager checkpointWriterManager, long defaultCheckpointInterval, boolean ignoreCheckpointWriteFailures, boolean deleteSchemaLocationsFallback, DeltaLakeRedirectionsProvider deltaLakeRedirectionsProvider, ExtendedStatisticsAccess statisticsAccess)
-
-
Method Detail
-
listSchemaNames
public List<String> listSchemaNames(ConnectorSession session)
- Specified by:
listSchemaNamesin interfaceConnectorMetadata
-
redirectTable
public Optional<CatalogSchemaTableName> redirectTable(ConnectorSession session, SchemaTableName tableName)
- Specified by:
redirectTablein interfaceConnectorMetadata
-
getTableHandle
public DeltaLakeTableHandle getTableHandle(ConnectorSession session, SchemaTableName tableName)
- Specified by:
getTableHandlein interfaceConnectorMetadata
-
getSchemaTableName
public SchemaTableName getSchemaTableName(ConnectorSession session, ConnectorTableHandle table)
- Specified by:
getSchemaTableNamein interfaceConnectorMetadata
-
getTableProperties
public ConnectorTableProperties getTableProperties(ConnectorSession session, ConnectorTableHandle tableHandle)
- Specified by:
getTablePropertiesin interfaceConnectorMetadata
-
getTableMetadata
public ConnectorTableMetadata getTableMetadata(ConnectorSession session, ConnectorTableHandle table)
- Specified by:
getTableMetadatain interfaceConnectorMetadata
-
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
-
getColumnMetadata
public ColumnMetadata getColumnMetadata(ConnectorSession session, ConnectorTableHandle tableHandle, ColumnHandle columnHandle)
- Specified by:
getColumnMetadatain interfaceConnectorMetadata
-
getNewTableLayout
public Optional<ConnectorTableLayout> getNewTableLayout(ConnectorSession session, ConnectorTableMetadata tableMetadata)
Provides partitioning scheme of table for query planner to decide how to write to multiple partitions.- Specified by:
getNewTableLayoutin interfaceConnectorMetadata
-
getInsertLayout
public Optional<ConnectorTableLayout> getInsertLayout(ConnectorSession session, ConnectorTableHandle tableHandle)
- Specified by:
getInsertLayoutin interfaceConnectorMetadata
-
listTableColumns
public Map<SchemaTableName,List<ColumnMetadata>> listTableColumns(ConnectorSession session, SchemaTablePrefix prefix)
- Specified by:
listTableColumnsin interfaceConnectorMetadata
-
streamTableColumns
public Stream<TableColumnsMetadata> streamTableColumns(ConnectorSession session, SchemaTablePrefix prefix)
- Specified by:
streamTableColumnsin interfaceConnectorMetadata
-
getTableStatistics
public TableStatistics getTableStatistics(ConnectorSession session, ConnectorTableHandle tableHandle)
- 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
-
createTable
public void createTable(ConnectorSession session, ConnectorTableMetadata tableMetadata, boolean ignoreExisting)
- Specified by:
createTablein interfaceConnectorMetadata
-
beginCreateTable
public DeltaLakeOutputTableHandle beginCreateTable(ConnectorSession session, ConnectorTableMetadata tableMetadata, Optional<ConnectorTableLayout> layout, RetryMode retryMode)
- Specified by:
beginCreateTablein interfaceConnectorMetadata
-
finishCreateTable
public Optional<ConnectorOutputMetadata> finishCreateTable(ConnectorSession session, ConnectorOutputTableHandle tableHandle, Collection<io.airlift.slice.Slice> fragments, Collection<ComputedStatistics> computedStatistics)
- Specified by:
finishCreateTablein interfaceConnectorMetadata
-
addColumn
public void addColumn(ConnectorSession session, ConnectorTableHandle tableHandle, ColumnMetadata newColumnMetadata)
- Specified by:
addColumnin interfaceConnectorMetadata
-
beginInsert
public ConnectorInsertTableHandle beginInsert(ConnectorSession session, ConnectorTableHandle tableHandle, List<ColumnHandle> columns, RetryMode retryMode)
- Specified by:
beginInsertin interfaceConnectorMetadata
-
finishInsert
public Optional<ConnectorOutputMetadata> finishInsert(ConnectorSession session, ConnectorInsertTableHandle insertHandle, Collection<io.airlift.slice.Slice> fragments, Collection<ComputedStatistics> computedStatistics)
- Specified by:
finishInsertin interfaceConnectorMetadata
-
getDeleteRowIdColumnHandle
public ColumnHandle getDeleteRowIdColumnHandle(ConnectorSession session, ConnectorTableHandle tableHandle)
- Specified by:
getDeleteRowIdColumnHandlein interfaceConnectorMetadata
-
beginDelete
public ConnectorTableHandle beginDelete(ConnectorSession session, ConnectorTableHandle tableHandle, RetryMode retryMode)
- Specified by:
beginDeletein interfaceConnectorMetadata
-
finishDelete
public void finishDelete(ConnectorSession session, ConnectorTableHandle tableHandle, Collection<io.airlift.slice.Slice> fragments)
- Specified by:
finishDeletein interfaceConnectorMetadata
-
getUpdateRowIdColumnHandle
public ColumnHandle getUpdateRowIdColumnHandle(ConnectorSession session, ConnectorTableHandle tableHandle, List<ColumnHandle> updatedColumns)
- Specified by:
getUpdateRowIdColumnHandlein interfaceConnectorMetadata
-
beginUpdate
public ConnectorTableHandle beginUpdate(ConnectorSession session, ConnectorTableHandle tableHandle, List<ColumnHandle> updatedColumns, RetryMode retryMode)
- Specified by:
beginUpdatein interfaceConnectorMetadata
-
finishUpdate
public void finishUpdate(ConnectorSession session, ConnectorTableHandle tableHandle, Collection<io.airlift.slice.Slice> fragments)
- Specified by:
finishUpdatein interfaceConnectorMetadata
-
getTableHandleForExecute
public Optional<ConnectorTableExecuteHandle> getTableHandleForExecute(ConnectorSession session, ConnectorTableHandle connectorTableHandle, String procedureName, Map<String,Object> executeProperties, RetryMode retryMode)
- Specified by:
getTableHandleForExecutein interfaceConnectorMetadata
-
getLayoutForTableExecute
public Optional<ConnectorTableLayout> getLayoutForTableExecute(ConnectorSession session, ConnectorTableExecuteHandle tableExecuteHandle)
- Specified by:
getLayoutForTableExecutein interfaceConnectorMetadata
-
beginTableExecute
public BeginTableExecuteResult<ConnectorTableExecuteHandle,ConnectorTableHandle> beginTableExecute(ConnectorSession session, ConnectorTableExecuteHandle tableExecuteHandle, ConnectorTableHandle updatedSourceTableHandle)
- Specified by:
beginTableExecutein interfaceConnectorMetadata
-
finishTableExecute
public void finishTableExecute(ConnectorSession session, ConnectorTableExecuteHandle tableExecuteHandle, Collection<io.airlift.slice.Slice> fragments, List<Object> splitSourceInfo)
- Specified by:
finishTableExecutein interfaceConnectorMetadata
-
dropTable
public void dropTable(ConnectorSession session, ConnectorTableHandle tableHandle)
- Specified by:
dropTablein interfaceConnectorMetadata
-
getSchemaProperties
public Map<String,Object> getSchemaProperties(ConnectorSession session, CatalogSchemaName schemaName)
- Specified by:
getSchemaPropertiesin interfaceConnectorMetadata
-
createRole
public void createRole(ConnectorSession session, String role, Optional<TrinoPrincipal> grantor)
- Specified by:
createRolein interfaceConnectorMetadata
-
dropRole
public void dropRole(ConnectorSession session, String role)
- Specified by:
dropRolein interfaceConnectorMetadata
-
listRoles
public Set<String> listRoles(ConnectorSession session)
- Specified by:
listRolesin interfaceConnectorMetadata
-
listRoleGrants
public Set<RoleGrant> listRoleGrants(ConnectorSession session, TrinoPrincipal principal)
- Specified by:
listRoleGrantsin interfaceConnectorMetadata
-
grantRoles
public void grantRoles(ConnectorSession session, Set<String> roles, Set<TrinoPrincipal> grantees, boolean withAdminOption, Optional<TrinoPrincipal> grantor)
- Specified by:
grantRolesin interfaceConnectorMetadata
-
revokeRoles
public void revokeRoles(ConnectorSession session, Set<String> roles, Set<TrinoPrincipal> grantees, boolean adminOptionFor, Optional<TrinoPrincipal> grantor)
- Specified by:
revokeRolesin interfaceConnectorMetadata
-
listApplicableRoles
public Set<RoleGrant> listApplicableRoles(ConnectorSession session, TrinoPrincipal principal)
- Specified by:
listApplicableRolesin interfaceConnectorMetadata
-
listEnabledRoles
public Set<String> listEnabledRoles(ConnectorSession session)
- Specified by:
listEnabledRolesin interfaceConnectorMetadata
-
grantTablePrivileges
public void grantTablePrivileges(ConnectorSession session, SchemaTableName schemaTableName, Set<Privilege> privileges, TrinoPrincipal grantee, boolean grantOption)
- Specified by:
grantTablePrivilegesin interfaceConnectorMetadata
-
revokeTablePrivileges
public void revokeTablePrivileges(ConnectorSession session, SchemaTableName schemaTableName, Set<Privilege> privileges, TrinoPrincipal grantee, boolean grantOption)
- Specified by:
revokeTablePrivilegesin interfaceConnectorMetadata
-
listTablePrivileges
public List<GrantInfo> listTablePrivileges(ConnectorSession session, SchemaTablePrefix schemaTablePrefix)
- Specified by:
listTablePrivilegesin interfaceConnectorMetadata
-
rollback
public void rollback()
-
applyFilter
public Optional<ConstraintApplicationResult<ConnectorTableHandle>> applyFilter(ConnectorSession session, ConnectorTableHandle handle, Constraint constraint)
- Specified by:
applyFilterin interfaceConnectorMetadata
-
applyProjection
public Optional<ProjectionApplicationResult<ConnectorTableHandle>> applyProjection(ConnectorSession session, ConnectorTableHandle tableHandle, List<ConnectorExpression> projections, Map<String,ColumnHandle> assignments)
- Specified by:
applyProjectionin interfaceConnectorMetadata
-
applyTableScanRedirect
public Optional<TableScanRedirectApplicationResult> applyTableScanRedirect(ConnectorSession session, ConnectorTableHandle tableHandle)
- Specified by:
applyTableScanRedirectin interfaceConnectorMetadata
-
getTableHandleForStatisticsCollection
@Nullable public ConnectorTableHandle getTableHandleForStatisticsCollection(ConnectorSession session, SchemaTableName tableName, Map<String,Object> analyzeProperties)
- Specified by:
getTableHandleForStatisticsCollectionin interfaceConnectorMetadata
-
getStatisticsCollectionMetadata
public TableStatisticsMetadata getStatisticsCollectionMetadata(ConnectorSession session, ConnectorTableMetadata tableMetadata)
- Specified by:
getStatisticsCollectionMetadatain interfaceConnectorMetadata
-
beginStatisticsCollection
public ConnectorTableHandle beginStatisticsCollection(ConnectorSession session, ConnectorTableHandle tableHandle)
- Specified by:
beginStatisticsCollectionin interfaceConnectorMetadata
-
finishStatisticsCollection
public void finishStatisticsCollection(ConnectorSession session, ConnectorTableHandle table, Collection<ComputedStatistics> computedStatistics)
- Specified by:
finishStatisticsCollectionin interfaceConnectorMetadata
-
supportsReportingWrittenBytes
public boolean supportsReportingWrittenBytes(ConnectorSession session, ConnectorTableHandle connectorTableHandle)
- Specified by:
supportsReportingWrittenBytesin interfaceConnectorMetadata
-
supportsReportingWrittenBytes
public boolean supportsReportingWrittenBytes(ConnectorSession session, SchemaTableName fullTableName, Map<String,Object> tableProperties)
- Specified by:
supportsReportingWrittenBytesin interfaceConnectorMetadata
-
getMetastore
public DeltaLakeMetastore getMetastore()
-
createStatisticsPredicate
public static TupleDomain<DeltaLakeColumnHandle> createStatisticsPredicate(AddFileEntry addFileEntry, List<ColumnMetadata> schema, List<String> canonicalPartitionColumns)
-
-