use of io.trino.spi.connector.ConnectorMetadata in project trino by trinodb.
the class MetadataManager method getTableSchema.
@Override
public TableSchema getTableSchema(Session session, TableHandle tableHandle) {
CatalogName catalogName = tableHandle.getCatalogName();
ConnectorMetadata metadata = getMetadata(session, catalogName);
ConnectorTableSchema tableSchema = metadata.getTableSchema(session.toConnectorSession(catalogName), tableHandle.getConnectorHandle());
return new TableSchema(catalogName, tableSchema);
}
use of io.trino.spi.connector.ConnectorMetadata in project trino by trinodb.
the class MetadataManager method createRole.
@Override
public void createRole(Session session, String role, Optional<TrinoPrincipal> grantor, Optional<String> catalog) {
if (catalog.isEmpty()) {
systemSecurityMetadata.createRole(session, role, grantor);
return;
}
CatalogMetadata catalogMetadata = getCatalogMetadataForWrite(session, catalog.get());
CatalogName catalogName = catalogMetadata.getCatalogName();
ConnectorMetadata metadata = catalogMetadata.getMetadata(session);
metadata.createRole(session.toConnectorSession(catalogName), role, grantor);
}
use of io.trino.spi.connector.ConnectorMetadata in project trino by trinodb.
the class MetadataManager method beginDelete.
@Override
public TableHandle beginDelete(Session session, TableHandle tableHandle) {
CatalogName catalogName = tableHandle.getCatalogName();
ConnectorMetadata metadata = getMetadataForWrite(session, catalogName);
ConnectorTableHandle newHandle = metadata.beginDelete(session.toConnectorSession(catalogName), tableHandle.getConnectorHandle(), getRetryPolicy(session).getRetryMode());
return new TableHandle(tableHandle.getCatalogName(), newHandle, tableHandle.getTransaction());
}
use of io.trino.spi.connector.ConnectorMetadata in project trino by trinodb.
the class MetadataManager method finishRefreshMaterializedView.
@Override
public Optional<ConnectorOutputMetadata> finishRefreshMaterializedView(Session session, TableHandle tableHandle, InsertTableHandle insertHandle, Collection<Slice> fragments, Collection<ComputedStatistics> computedStatistics, List<TableHandle> sourceTableHandles) {
CatalogName catalogName = insertHandle.getCatalogName();
ConnectorMetadata metadata = getMetadata(session, catalogName);
List<ConnectorTableHandle> sourceConnectorHandles = sourceTableHandles.stream().map(TableHandle::getConnectorHandle).collect(toImmutableList());
return metadata.finishRefreshMaterializedView(session.toConnectorSession(catalogName), tableHandle.getConnectorHandle(), insertHandle.getConnectorHandle(), fragments, computedStatistics, sourceConnectorHandles);
}
use of io.trino.spi.connector.ConnectorMetadata in project trino by trinodb.
the class MetadataManager method applyAggregation.
@Override
public Optional<AggregationApplicationResult<TableHandle>> applyAggregation(Session session, TableHandle table, List<AggregateFunction> aggregations, Map<String, ColumnHandle> assignments, List<List<ColumnHandle>> groupingSets) {
// Global aggregation is represented by [[]]
checkArgument(!groupingSets.isEmpty(), "No grouping sets provided");
CatalogName catalogName = table.getCatalogName();
ConnectorMetadata metadata = getMetadata(session, catalogName);
ConnectorSession connectorSession = session.toConnectorSession(catalogName);
return metadata.applyAggregation(connectorSession, table.getConnectorHandle(), aggregations, assignments, groupingSets).map(result -> {
verifyProjection(table, result.getProjections(), result.getAssignments(), aggregations.size());
return new AggregationApplicationResult<>(new TableHandle(catalogName, result.getHandle(), table.getTransaction()), result.getProjections(), result.getAssignments(), result.getGroupingColumnMapping(), result.isPrecalculateStatistics());
});
}
Aggregations