Search in sources :

Example 1 with ConnectorPlanOptimizerProvider

use of io.prestosql.spi.connector.ConnectorPlanOptimizerProvider in project boostkit-bigdata by kunpengcompute.

the class HiveConnectorFactory method create.

@Override
public Connector create(String catalogName, Map<String, String> config, ConnectorContext context) {
    requireNonNull(config, "config is null");
    try (ThreadContextClassLoader ignored = new ThreadContextClassLoader(classLoader)) {
        Bootstrap app = new Bootstrap(new EventModule(), new MBeanModule(), new ConnectorObjectNameGeneratorModule(catalogName), new JsonModule(), new HiveModule(), new HiveS3Module(), new HiveGcsModule(), new HiveMetastoreModule(metastore), new HiveSecurityModule(), new HiveAuthenticationModule(), new HiveProcedureModule(), new MBeanServerModule(), binder -> {
            binder.bind(NodeVersion.class).toInstance(new NodeVersion(context.getNodeManager().getCurrentNode().getVersion()));
            binder.bind(NodeManager.class).toInstance(context.getNodeManager());
            binder.bind(VersionEmbedder.class).toInstance(context.getVersionEmbedder());
            binder.bind(TypeManager.class).toInstance(context.getTypeManager());
            binder.bind(PageIndexerFactory.class).toInstance(context.getPageIndexerFactory());
            binder.bind(PageSorter.class).toInstance(context.getPageSorter());
            binder.bind(HiveCatalogName.class).toInstance(new HiveCatalogName(catalogName));
            binder.bind(IndexClient.class).toInstance(context.getIndexClient());
            binder.bind(StandardFunctionResolution.class).toInstance(context.getStandardFunctionResolution());
            binder.bind(FunctionMetadataManager.class).toInstance(context.getFunctionMetadataManager());
            binder.bind(FilterStatsCalculatorService.class).toInstance(context.getFilterStatsCalculatorService());
            binder.bind(RowExpressionService.class).toInstance(context.getRowExpressionService());
        });
        Injector injector = app.strictConfig().doNotInitializeLogging().setRequiredConfigurationProperties(config).initialize();
        LifeCycleManager lifeCycleManager = injector.getInstance(LifeCycleManager.class);
        HiveMetadataFactory metadataFactory = injector.getInstance(HiveMetadataFactory.class);
        HiveTransactionManager transactionManager = injector.getInstance(HiveTransactionManager.class);
        ConnectorSplitManager splitManager = injector.getInstance(ConnectorSplitManager.class);
        ConnectorPageSourceProvider connectorPageSource = injector.getInstance(ConnectorPageSourceProvider.class);
        ConnectorPageSinkProvider pageSinkProvider = injector.getInstance(ConnectorPageSinkProvider.class);
        ConnectorNodePartitioningProvider connectorDistributionProvider = injector.getInstance(ConnectorNodePartitioningProvider.class);
        HiveSessionProperties hiveSessionProperties = injector.getInstance(HiveSessionProperties.class);
        HiveTableProperties hiveTableProperties = injector.getInstance(HiveTableProperties.class);
        HiveAnalyzeProperties hiveAnalyzeProperties = injector.getInstance(HiveAnalyzeProperties.class);
        ConnectorAccessControl accessControl = new SystemTableAwareAccessControl(injector.getInstance(ConnectorAccessControl.class));
        Set<Procedure> procedures = injector.getInstance(Key.get(new TypeLiteral<Set<Procedure>>() {
        }));
        ConnectorPlanOptimizerProvider planOptimizerProvider = injector.getInstance(ConnectorPlanOptimizerProvider.class);
        OmniDataNodeManager nodeManagerInstance = injector.getInstance(OmniDataNodeManager.class);
        HivePushdownUtil.setOmniDataNodeManager(nodeManagerInstance);
        nodeManagerInstance.startPollingNodeStates();
        return new HiveConnector(lifeCycleManager, metadataFactory, transactionManager, new ClassLoaderSafeConnectorSplitManager(splitManager, classLoader), new ClassLoaderSafeConnectorPageSourceProvider(connectorPageSource, classLoader), new ClassLoaderSafeConnectorPageSinkProvider(pageSinkProvider, classLoader), new ClassLoaderSafeNodePartitioningProvider(connectorDistributionProvider, classLoader), ImmutableSet.of(), procedures, hiveSessionProperties.getSessionProperties(), HiveSchemaProperties.SCHEMA_PROPERTIES, hiveTableProperties.getTableProperties(), hiveAnalyzeProperties.getAnalyzeProperties(), accessControl, planOptimizerProvider, classLoader);
    } catch (Exception e) {
        throwIfUnchecked(e);
        throw new RuntimeException(e);
    }
}
Also used : FilterStatsCalculatorService(io.prestosql.spi.plan.FilterStatsCalculatorService) ClassLoaderSafeConnectorPageSourceProvider(io.prestosql.spi.connector.classloader.ClassLoaderSafeConnectorPageSourceProvider) Injector(com.google.inject.Injector) PageSorter(io.prestosql.spi.PageSorter) Procedure(io.prestosql.spi.procedure.Procedure) HiveMetastoreModule(io.prestosql.plugin.hive.metastore.HiveMetastoreModule) ClassLoaderSafeNodePartitioningProvider(io.prestosql.spi.connector.classloader.ClassLoaderSafeNodePartitioningProvider) ConnectorAccessControl(io.prestosql.spi.connector.ConnectorAccessControl) IndexClient(io.prestosql.spi.heuristicindex.IndexClient) ClassLoaderSafeConnectorPageSinkProvider(io.prestosql.spi.connector.classloader.ClassLoaderSafeConnectorPageSinkProvider) JsonModule(io.airlift.json.JsonModule) PageIndexerFactory(io.prestosql.spi.PageIndexerFactory) OmniDataNodeManager(io.prestosql.plugin.hive.omnidata.OmniDataNodeManager) NodeManager(io.prestosql.spi.NodeManager) LifeCycleManager(io.airlift.bootstrap.LifeCycleManager) ConnectorSplitManager(io.prestosql.spi.connector.ConnectorSplitManager) ClassLoaderSafeConnectorSplitManager(io.prestosql.spi.connector.classloader.ClassLoaderSafeConnectorSplitManager) SystemTableAwareAccessControl(io.prestosql.plugin.hive.security.SystemTableAwareAccessControl) MBeanModule(org.weakref.jmx.guice.MBeanModule) ConnectorPlanOptimizerProvider(io.prestosql.spi.connector.ConnectorPlanOptimizerProvider) EventModule(io.airlift.event.client.EventModule) TypeLiteral(com.google.inject.TypeLiteral) RowExpressionService(io.prestosql.spi.relation.RowExpressionService) OmniDataNodeManager(io.prestosql.plugin.hive.omnidata.OmniDataNodeManager) HiveSecurityModule(io.prestosql.plugin.hive.security.HiveSecurityModule) Bootstrap(io.airlift.bootstrap.Bootstrap) ThreadContextClassLoader(io.prestosql.spi.classloader.ThreadContextClassLoader) HiveAuthenticationModule(io.prestosql.plugin.hive.authentication.HiveAuthenticationModule) VersionEmbedder(io.prestosql.spi.VersionEmbedder) FunctionMetadataManager(io.prestosql.spi.function.FunctionMetadataManager) HiveS3Module(io.prestosql.plugin.hive.s3.HiveS3Module) ClassLoaderSafeConnectorPageSinkProvider(io.prestosql.spi.connector.classloader.ClassLoaderSafeConnectorPageSinkProvider) ConnectorPageSinkProvider(io.prestosql.spi.connector.ConnectorPageSinkProvider) HiveGcsModule(io.prestosql.plugin.hive.gcs.HiveGcsModule) ClassLoaderSafeConnectorPageSourceProvider(io.prestosql.spi.connector.classloader.ClassLoaderSafeConnectorPageSourceProvider) ConnectorPageSourceProvider(io.prestosql.spi.connector.ConnectorPageSourceProvider) MBeanServerModule(io.prestosql.plugin.base.jmx.MBeanServerModule) ConnectorNodePartitioningProvider(io.prestosql.spi.connector.ConnectorNodePartitioningProvider) ClassLoaderSafeConnectorSplitManager(io.prestosql.spi.connector.classloader.ClassLoaderSafeConnectorSplitManager) TypeManager(io.prestosql.spi.type.TypeManager) StandardFunctionResolution(io.prestosql.spi.function.StandardFunctionResolution)

Aggregations

Injector (com.google.inject.Injector)1 TypeLiteral (com.google.inject.TypeLiteral)1 Bootstrap (io.airlift.bootstrap.Bootstrap)1 LifeCycleManager (io.airlift.bootstrap.LifeCycleManager)1 EventModule (io.airlift.event.client.EventModule)1 JsonModule (io.airlift.json.JsonModule)1 MBeanServerModule (io.prestosql.plugin.base.jmx.MBeanServerModule)1 HiveAuthenticationModule (io.prestosql.plugin.hive.authentication.HiveAuthenticationModule)1 HiveGcsModule (io.prestosql.plugin.hive.gcs.HiveGcsModule)1 HiveMetastoreModule (io.prestosql.plugin.hive.metastore.HiveMetastoreModule)1 OmniDataNodeManager (io.prestosql.plugin.hive.omnidata.OmniDataNodeManager)1 HiveS3Module (io.prestosql.plugin.hive.s3.HiveS3Module)1 HiveSecurityModule (io.prestosql.plugin.hive.security.HiveSecurityModule)1 SystemTableAwareAccessControl (io.prestosql.plugin.hive.security.SystemTableAwareAccessControl)1 NodeManager (io.prestosql.spi.NodeManager)1 PageIndexerFactory (io.prestosql.spi.PageIndexerFactory)1 PageSorter (io.prestosql.spi.PageSorter)1 VersionEmbedder (io.prestosql.spi.VersionEmbedder)1 ThreadContextClassLoader (io.prestosql.spi.classloader.ThreadContextClassLoader)1 ConnectorAccessControl (io.prestosql.spi.connector.ConnectorAccessControl)1