Search in sources :

Example 1 with SystemTablesProvider

use of io.prestosql.connector.system.SystemTablesProvider in project hetu-core by openlookeng.

the class ConnectorManager method addCatalogConnector.

public synchronized void addCatalogConnector(CatalogName catalogName, Connector catalogConnector) {
    MaterializedConnector connector = new MaterializedConnector(catalogName, catalogConnector);
    MaterializedConnector informationSchemaConnector = new MaterializedConnector(createInformationSchemaCatalogName(catalogName), new InformationSchemaConnector(catalogName.getCatalogName(), nodeManager, metadataManager, accessControlManager));
    CatalogName systemId = createSystemTablesCatalogName(catalogName);
    SystemTablesProvider systemTablesProvider;
    if (nodeManager.getCurrentNode().isCoordinator()) {
        systemTablesProvider = new DelegatingSystemTablesProvider(new StaticSystemTablesProvider(connector.getSystemTables()), new MetadataBasedSystemTablesProvider(metadataManager, catalogName.getCatalogName()));
    } else {
        systemTablesProvider = new StaticSystemTablesProvider(connector.getSystemTables());
    }
    MaterializedConnector systemConnector = new MaterializedConnector(systemId, new SystemConnector(nodeManager, systemTablesProvider, transactionId -> transactionManager.getConnectorTransaction(transactionId, catalogName)));
    Catalog catalog = new Catalog(catalogName.getCatalogName(), connector.getCatalogName(), connector.getConnector(), informationSchemaConnector.getCatalogName(), informationSchemaConnector.getConnector(), systemConnector.getCatalogName(), systemConnector.getConnector());
    try {
        addConnectorInternal(connector);
        addConnectorInternal(informationSchemaConnector);
        addConnectorInternal(systemConnector);
        catalogManager.registerCatalog(catalog);
    } catch (Throwable e) {
        catalogManager.removeCatalog(catalog.getCatalogName());
        removeConnectorInternal(systemConnector.getCatalogName());
        removeConnectorInternal(informationSchemaConnector.getCatalogName());
        removeConnectorInternal(connector.getCatalogName());
        throw e;
    }
}
Also used : SystemConnector(io.prestosql.connector.system.SystemConnector) ConnectorPlanOptimizerProvider(io.prestosql.spi.connector.ConnectorPlanOptimizerProvider) CONNECTION_USER(io.prestosql.spi.HetuConstant.CONNECTION_USER) VersionEmbedder(io.prestosql.spi.VersionEmbedder) ConnectorAccessControl(io.prestosql.spi.connector.ConnectorAccessControl) ConnectorSplitManager(io.prestosql.spi.connector.ConnectorSplitManager) NodeInfo(io.airlift.node.NodeInfo) FilterStatsCalculator(io.prestosql.cost.FilterStatsCalculator) ConnectorFilterStatsCalculatorService(io.prestosql.cost.ConnectorFilterStatsCalculatorService) DeterminismEvaluator(io.prestosql.spi.relation.DeterminismEvaluator) ServerConfig(io.prestosql.server.ServerConfig) RecordPageSourceProvider(io.prestosql.split.RecordPageSourceProvider) PreDestroy(javax.annotation.PreDestroy) ConnectorPlanOptimizerManager(io.prestosql.sql.planner.ConnectorPlanOptimizerManager) Preconditions.checkArgument(com.google.common.base.Preconditions.checkArgument) PrestoTransportException(io.prestosql.spi.PrestoTransportException) Procedure(io.prestosql.spi.procedure.Procedure) ConnectorNodePartitioningProvider(io.prestosql.spi.connector.ConnectorNodePartitioningProvider) Map(java.util.Map) PropertyMetadata(io.prestosql.spi.session.PropertyMetadata) ConnectorPageSinkProvider(io.prestosql.spi.connector.ConnectorPageSinkProvider) Announcer(io.airlift.discovery.client.Announcer) HeuristicIndexerManager(io.prestosql.heuristicindex.HeuristicIndexerManager) PageIndexerFactory(io.prestosql.spi.PageIndexerFactory) PrestoException(io.prestosql.spi.PrestoException) ImmutableSet(com.google.common.collect.ImmutableSet) SystemTable(io.prestosql.spi.connector.SystemTable) DomainTranslator(io.prestosql.spi.relation.DomainTranslator) DATA_CENTER_CONNECTOR_NAME(io.prestosql.spi.HetuConstant.DATA_CENTER_CONNECTOR_NAME) CatalogName(io.prestosql.spi.connector.CatalogName) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) Set(java.util.Set) ThreadSafe(javax.annotation.concurrent.ThreadSafe) NodeSchedulerConfig(io.prestosql.execution.scheduler.NodeSchedulerConfig) GuardedBy(javax.annotation.concurrent.GuardedBy) ExternalFunctionHub(io.prestosql.spi.function.ExternalFunctionHub) MetadataManager(io.prestosql.metadata.MetadataManager) String.format(java.lang.String.format) Preconditions.checkState(com.google.common.base.Preconditions.checkState) List(java.util.List) FunctionResolution(io.prestosql.sql.relational.FunctionResolution) ConnectorRecordSetProvider(io.prestosql.spi.connector.ConnectorRecordSetProvider) PageSinkManager(io.prestosql.split.PageSinkManager) Optional(java.util.Optional) FunctionAndTypeManager(io.prestosql.metadata.FunctionAndTypeManager) Joiner(com.google.common.base.Joiner) Connector(io.prestosql.spi.connector.Connector) NodePartitioningManager(io.prestosql.sql.planner.NodePartitioningManager) REMOTE_TASK_ERROR(io.prestosql.spi.StandardErrorCode.REMOTE_TASK_ERROR) Logger(io.airlift.log.Logger) EmbedVersion(io.prestosql.version.EmbedVersion) TransactionManager(io.prestosql.transaction.TransactionManager) ConnectorContext(io.prestosql.spi.connector.ConnectorContext) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) HashMap(java.util.HashMap) AccessControlManager(io.prestosql.security.AccessControlManager) SqlInvokedFunction(io.prestosql.spi.function.SqlInvokedFunction) FunctionExtractor.extractExternalFunctions(io.prestosql.metadata.FunctionExtractor.extractExternalFunctions) StaticSystemTablesProvider(io.prestosql.connector.system.StaticSystemTablesProvider) ConcurrentMap(java.util.concurrent.ConcurrentMap) InformationSchemaConnector(io.prestosql.connector.informationschema.InformationSchemaConnector) Inject(javax.inject.Inject) ConnectorIndexProvider(io.prestosql.spi.connector.ConnectorIndexProvider) MetadataBasedSystemTablesProvider(io.prestosql.connector.system.MetadataBasedSystemTablesProvider) ImmutableList(com.google.common.collect.ImmutableList) SystemTablesProvider(io.prestosql.connector.system.SystemTablesProvider) Verify.verify(com.google.common.base.Verify.verify) CatalogName.createSystemTablesCatalogName(io.prestosql.spi.connector.CatalogName.createSystemTablesCatalogName) Objects.requireNonNull(java.util.Objects.requireNonNull) PageSourceManager(io.prestosql.split.PageSourceManager) SystemConnector(io.prestosql.connector.system.SystemConnector) LinkedHashSet(java.util.LinkedHashSet) InternalNodeManager(io.prestosql.metadata.InternalNodeManager) InternalTypeManager(io.prestosql.type.InternalTypeManager) IndexManager(io.prestosql.index.IndexManager) CatalogName.createInformationSchemaCatalogName(io.prestosql.spi.connector.CatalogName.createInformationSchemaCatalogName) ThreadContextClassLoader(io.prestosql.spi.classloader.ThreadContextClassLoader) PageSorter(io.prestosql.spi.PageSorter) Field(java.lang.reflect.Field) ServiceAnnouncement(io.airlift.discovery.client.ServiceAnnouncement) DelegatingSystemTablesProvider(io.prestosql.connector.system.DelegatingSystemTablesProvider) Catalog(io.prestosql.metadata.Catalog) HandleResolver(io.prestosql.metadata.HandleResolver) HetuMetaStoreManager(io.prestosql.metastore.HetuMetaStoreManager) ConnectorFactory(io.prestosql.spi.connector.ConnectorFactory) SplitManager(io.prestosql.split.SplitManager) CatalogManager(io.prestosql.metadata.CatalogManager) ConnectorRowExpressionService(io.prestosql.sql.relational.ConnectorRowExpressionService) ConnectorPageSourceProvider(io.prestosql.spi.connector.ConnectorPageSourceProvider) StaticSystemTablesProvider(io.prestosql.connector.system.StaticSystemTablesProvider) InformationSchemaConnector(io.prestosql.connector.informationschema.InformationSchemaConnector) DelegatingSystemTablesProvider(io.prestosql.connector.system.DelegatingSystemTablesProvider) MetadataBasedSystemTablesProvider(io.prestosql.connector.system.MetadataBasedSystemTablesProvider) CatalogName(io.prestosql.spi.connector.CatalogName) CatalogName.createSystemTablesCatalogName(io.prestosql.spi.connector.CatalogName.createSystemTablesCatalogName) CatalogName.createInformationSchemaCatalogName(io.prestosql.spi.connector.CatalogName.createInformationSchemaCatalogName) StaticSystemTablesProvider(io.prestosql.connector.system.StaticSystemTablesProvider) MetadataBasedSystemTablesProvider(io.prestosql.connector.system.MetadataBasedSystemTablesProvider) SystemTablesProvider(io.prestosql.connector.system.SystemTablesProvider) DelegatingSystemTablesProvider(io.prestosql.connector.system.DelegatingSystemTablesProvider) Catalog(io.prestosql.metadata.Catalog)

Aggregations

Joiner (com.google.common.base.Joiner)1 Preconditions.checkArgument (com.google.common.base.Preconditions.checkArgument)1 Preconditions.checkState (com.google.common.base.Preconditions.checkState)1 Verify.verify (com.google.common.base.Verify.verify)1 ImmutableList (com.google.common.collect.ImmutableList)1 ImmutableSet (com.google.common.collect.ImmutableSet)1 Announcer (io.airlift.discovery.client.Announcer)1 ServiceAnnouncement (io.airlift.discovery.client.ServiceAnnouncement)1 Logger (io.airlift.log.Logger)1 NodeInfo (io.airlift.node.NodeInfo)1 InformationSchemaConnector (io.prestosql.connector.informationschema.InformationSchemaConnector)1 DelegatingSystemTablesProvider (io.prestosql.connector.system.DelegatingSystemTablesProvider)1 MetadataBasedSystemTablesProvider (io.prestosql.connector.system.MetadataBasedSystemTablesProvider)1 StaticSystemTablesProvider (io.prestosql.connector.system.StaticSystemTablesProvider)1 SystemConnector (io.prestosql.connector.system.SystemConnector)1 SystemTablesProvider (io.prestosql.connector.system.SystemTablesProvider)1 ConnectorFilterStatsCalculatorService (io.prestosql.cost.ConnectorFilterStatsCalculatorService)1 FilterStatsCalculator (io.prestosql.cost.FilterStatsCalculator)1 NodeSchedulerConfig (io.prestosql.execution.scheduler.NodeSchedulerConfig)1 HeuristicIndexerManager (io.prestosql.heuristicindex.HeuristicIndexerManager)1