use of com.facebook.presto.spi.ConnectorId in project presto by prestodb.
the class MetadataManager method toExplainIOConstraints.
@Override
public TupleDomain<ColumnHandle> toExplainIOConstraints(Session session, TableHandle tableHandle, TupleDomain<ColumnHandle> constraints) {
ConnectorId connectorId = tableHandle.getConnectorId();
ConnectorMetadata metadata = getMetadata(session, connectorId);
return metadata.toExplainIOConstraints(session.toConnectorSession(connectorId), tableHandle.getConnectorHandle(), constraints);
}
use of com.facebook.presto.spi.ConnectorId in project presto by prestodb.
the class MetadataManager method listRoles.
@Override
public Set<String> listRoles(Session session, String catalog) {
Optional<CatalogMetadata> catalogMetadata = getOptionalCatalogMetadata(session, catalog);
if (!catalogMetadata.isPresent()) {
return ImmutableSet.of();
}
ConnectorId connectorId = catalogMetadata.get().getConnectorId();
ConnectorSession connectorSession = session.toConnectorSession(connectorId);
ConnectorMetadata metadata = catalogMetadata.get().getMetadataFor(connectorId);
return metadata.listRoles(connectorSession).stream().map(role -> role.toLowerCase(ENGLISH)).collect(toImmutableSet());
}
use of com.facebook.presto.spi.ConnectorId in project presto by prestodb.
the class MetadataManager method createRole.
@Override
public void createRole(Session session, String role, Optional<PrestoPrincipal> grantor, String catalog) {
CatalogMetadata catalogMetadata = getCatalogMetadataForWrite(session, catalog);
ConnectorId connectorId = catalogMetadata.getConnectorId();
ConnectorMetadata metadata = catalogMetadata.getMetadata();
metadata.createRole(session.toConnectorSession(connectorId), role, grantor);
}
use of com.facebook.presto.spi.ConnectorId in project presto by prestodb.
the class MetadataManager method getViews.
@Override
public Map<QualifiedObjectName, ViewDefinition> getViews(Session session, QualifiedTablePrefix prefix) {
requireNonNull(prefix, "prefix is null");
Optional<CatalogMetadata> catalog = getOptionalCatalogMetadata(session, prefix.getCatalogName());
Map<QualifiedObjectName, ViewDefinition> views = new LinkedHashMap<>();
if (catalog.isPresent()) {
CatalogMetadata catalogMetadata = catalog.get();
SchemaTablePrefix tablePrefix = prefix.asSchemaTablePrefix();
for (ConnectorId connectorId : catalogMetadata.listConnectorIds()) {
ConnectorMetadata metadata = catalogMetadata.getMetadataFor(connectorId);
ConnectorSession connectorSession = session.toConnectorSession(connectorId);
for (Entry<SchemaTableName, ConnectorViewDefinition> entry : metadata.getViews(connectorSession, tablePrefix).entrySet()) {
QualifiedObjectName viewName = new QualifiedObjectName(prefix.getCatalogName(), entry.getKey().getSchemaName(), entry.getKey().getTableName());
views.put(viewName, deserializeView(entry.getValue().getViewData()));
}
}
}
return ImmutableMap.copyOf(views);
}
use of com.facebook.presto.spi.ConnectorId in project presto by prestodb.
the class MetadataManager method getPreferredShuffleLayoutForNewTable.
@Override
public Optional<NewTableLayout> getPreferredShuffleLayoutForNewTable(Session session, String catalogName, ConnectorTableMetadata tableMetadata) {
CatalogMetadata catalogMetadata = getCatalogMetadataForWrite(session, catalogName);
ConnectorId connectorId = catalogMetadata.getConnectorId();
ConnectorMetadata metadata = catalogMetadata.getMetadata();
ConnectorTransactionHandle transactionHandle = catalogMetadata.getTransactionHandleFor(connectorId);
ConnectorSession connectorSession = session.toConnectorSession(connectorId);
return metadata.getPreferredShuffleLayoutForNewTable(connectorSession, tableMetadata).map(layout -> new NewTableLayout(connectorId, transactionHandle, layout));
}
Aggregations