Search in sources :

Example 56 with ConnectorId

use of com.facebook.presto.connector.ConnectorId in project presto by prestodb.

the class MetadataManager method revokeTablePrivileges.

@Override
public void revokeTablePrivileges(Session session, QualifiedObjectName tableName, Set<Privilege> privileges, String grantee, boolean grantOption) {
    CatalogMetadata catalogMetadata = getCatalogMetadataForWrite(session, tableName.getCatalogName());
    ConnectorId connectorId = catalogMetadata.getConnectorId();
    ConnectorMetadata metadata = catalogMetadata.getMetadata();
    metadata.revokeTablePrivileges(session.toConnectorSession(connectorId), tableName.asSchemaTableName(), privileges, grantee, grantOption);
}
Also used : ConnectorMetadata(com.facebook.presto.spi.connector.ConnectorMetadata) ConnectorId(com.facebook.presto.connector.ConnectorId)

Example 57 with ConnectorId

use of com.facebook.presto.connector.ConnectorId in project presto by prestodb.

the class MetadataManager method createSchema.

@Override
public void createSchema(Session session, CatalogSchemaName schema, Map<String, Object> properties) {
    CatalogMetadata catalogMetadata = getCatalogMetadataForWrite(session, schema.getCatalogName());
    ConnectorId connectorId = catalogMetadata.getConnectorId();
    ConnectorMetadata metadata = catalogMetadata.getMetadata();
    metadata.createSchema(session.toConnectorSession(connectorId), schema.getSchemaName(), properties);
}
Also used : ConnectorMetadata(com.facebook.presto.spi.connector.ConnectorMetadata) ConnectorId(com.facebook.presto.connector.ConnectorId)

Example 58 with ConnectorId

use of com.facebook.presto.connector.ConnectorId in project presto by prestodb.

the class MetadataManager method beginQuery.

@Override
public void beginQuery(Session session, Set<ConnectorId> connectors) {
    for (ConnectorId connectorId : connectors) {
        ConnectorMetadata metadata = getMetadata(session, connectorId);
        ConnectorSession connectorSession = session.toConnectorSession(connectorId);
        metadata.beginQuery(connectorSession);
        registerCatalogForQueryId(session.getQueryId(), metadata);
    }
}
Also used : ConnectorSession(com.facebook.presto.spi.ConnectorSession) ConnectorMetadata(com.facebook.presto.spi.connector.ConnectorMetadata) ConnectorId(com.facebook.presto.connector.ConnectorId)

Example 59 with ConnectorId

use of com.facebook.presto.connector.ConnectorId in project presto by prestodb.

the class MetadataManager method finishCreateTable.

@Override
public Optional<ConnectorOutputMetadata> finishCreateTable(Session session, OutputTableHandle tableHandle, Collection<Slice> fragments) {
    ConnectorId connectorId = tableHandle.getConnectorId();
    ConnectorMetadata metadata = getMetadata(session, connectorId);
    return metadata.finishCreateTable(session.toConnectorSession(connectorId), tableHandle.getConnectorHandle(), fragments);
}
Also used : ConnectorMetadata(com.facebook.presto.spi.connector.ConnectorMetadata) ConnectorId(com.facebook.presto.connector.ConnectorId)

Example 60 with ConnectorId

use of com.facebook.presto.connector.ConnectorId in project presto by prestodb.

the class MetadataManager method getView.

@Override
public Optional<ViewDefinition> getView(Session session, QualifiedObjectName viewName) {
    Optional<CatalogMetadata> catalog = getOptionalCatalogMetadata(session, viewName.getCatalogName());
    if (catalog.isPresent()) {
        CatalogMetadata catalogMetadata = catalog.get();
        ConnectorId connectorId = catalogMetadata.getConnectorId(viewName);
        ConnectorMetadata metadata = catalogMetadata.getMetadataFor(connectorId);
        Map<SchemaTableName, ConnectorViewDefinition> views = metadata.getViews(session.toConnectorSession(connectorId), viewName.asSchemaTableName().toSchemaTablePrefix());
        ConnectorViewDefinition view = views.get(viewName.asSchemaTableName());
        if (view != null) {
            return Optional.of(deserializeView(view.getViewData()));
        }
    }
    return Optional.empty();
}
Also used : ConnectorMetadata(com.facebook.presto.spi.connector.ConnectorMetadata) SchemaTableName(com.facebook.presto.spi.SchemaTableName) QualifiedObjectName.convertFromSchemaTableName(com.facebook.presto.metadata.QualifiedObjectName.convertFromSchemaTableName) ConnectorId(com.facebook.presto.connector.ConnectorId) ConnectorViewDefinition(com.facebook.presto.spi.ConnectorViewDefinition)

Aggregations

ConnectorId (com.facebook.presto.connector.ConnectorId)76 ConnectorMetadata (com.facebook.presto.spi.connector.ConnectorMetadata)39 ConnectorSession (com.facebook.presto.spi.ConnectorSession)14 Session (com.facebook.presto.Session)12 PrestoException (com.facebook.presto.spi.PrestoException)9 ConnectorTransactionHandle (com.facebook.presto.spi.connector.ConnectorTransactionHandle)7 Test (org.testng.annotations.Test)7 ConnectorId.createInformationSchemaConnectorId (com.facebook.presto.connector.ConnectorId.createInformationSchemaConnectorId)5 ConnectorId.createSystemTablesConnectorId (com.facebook.presto.connector.ConnectorId.createSystemTablesConnectorId)5 TableHandle (com.facebook.presto.metadata.TableHandle)5 ConnectorTableMetadata (com.facebook.presto.spi.ConnectorTableMetadata)5 SchemaTableName (com.facebook.presto.spi.SchemaTableName)5 PlanNodeId (com.facebook.presto.sql.planner.plan.PlanNodeId)5 ImmutableList (com.google.common.collect.ImmutableList)5 QualifiedObjectName (com.facebook.presto.metadata.QualifiedObjectName)4 QualifiedObjectName.convertFromSchemaTableName (com.facebook.presto.metadata.QualifiedObjectName.convertFromSchemaTableName)4 SessionPropertyManager (com.facebook.presto.metadata.SessionPropertyManager)4 ConnectorInsertTableHandle (com.facebook.presto.spi.ConnectorInsertTableHandle)4 SemanticException (com.facebook.presto.sql.analyzer.SemanticException)4 TransactionManager (com.facebook.presto.transaction.TransactionManager)4