Search in sources :

Example 1 with NodeVersion

use of com.facebook.presto.hive.NodeVersion in project presto by prestodb.

the class InternalIcebergConnectorFactory method createConnector.

public static Connector createConnector(String catalogName, Map<String, String> config, ConnectorContext context, Optional<ExtendedHiveMetastore> metastore) {
    ClassLoader classLoader = InternalIcebergConnectorFactory.class.getClassLoader();
    try (ThreadContextClassLoader ignored = new ThreadContextClassLoader(classLoader)) {
        Bootstrap app = new Bootstrap(new EventModule(), new MBeanModule(), new JsonModule(), new IcebergModule(catalogName), new IcebergMetastoreModule(), new HiveS3Module(catalogName), new HiveAuthenticationModule(), new HiveMetastoreModule(catalogName, metastore), new CachingModule(), binder -> {
            binder.bind(NodeVersion.class).toInstance(new NodeVersion(context.getNodeManager().getCurrentNode().getVersion()));
            binder.bind(NodeManager.class).toInstance(context.getNodeManager());
            binder.bind(TypeManager.class).toInstance(context.getTypeManager());
            binder.bind(PageIndexerFactory.class).toInstance(context.getPageIndexerFactory());
            binder.bind(StandardFunctionResolution.class).toInstance(context.getStandardFunctionResolution());
            binder.bind(RowExpressionService.class).toInstance(context.getRowExpressionService());
        });
        Injector injector = app.doNotInitializeLogging().setRequiredConfigurationProperties(config).initialize();
        LifeCycleManager lifeCycleManager = injector.getInstance(LifeCycleManager.class);
        IcebergTransactionManager transactionManager = injector.getInstance(IcebergTransactionManager.class);
        IcebergMetadataFactory metadataFactory = injector.getInstance(IcebergMetadataFactory.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);
        IcebergSessionProperties icebergSessionProperties = injector.getInstance(IcebergSessionProperties.class);
        IcebergTableProperties icebergTableProperties = injector.getInstance(IcebergTableProperties.class);
        Set<Procedure> procedures = injector.getInstance((Key<Set<Procedure>>) Key.get(Types.setOf(Procedure.class)));
        ConnectorPlanOptimizer planOptimizer = injector.getInstance(IcebergPlanOptimizer.class);
        return new IcebergConnector(lifeCycleManager, transactionManager, metadataFactory, new ClassLoaderSafeConnectorSplitManager(splitManager, classLoader), new ClassLoaderSafeConnectorPageSourceProvider(connectorPageSource, classLoader), new ClassLoaderSafeConnectorPageSinkProvider(pageSinkProvider, classLoader), new ClassLoaderSafeNodePartitioningProvider(connectorDistributionProvider, classLoader), ImmutableSet.of(), icebergSessionProperties.getSessionProperties(), IcebergSchemaProperties.SCHEMA_PROPERTIES, icebergTableProperties.getTableProperties(), new AllowAllAccessControl(), procedures, planOptimizer);
    }
}
Also used : MBeanModule(org.weakref.jmx.guice.MBeanModule) ImmutableSet(com.google.common.collect.ImmutableSet) Set(java.util.Set) EventModule(com.facebook.airlift.event.client.EventModule) NodeVersion(com.facebook.presto.hive.NodeVersion) ClassLoaderSafeConnectorPageSourceProvider(com.facebook.presto.spi.connector.classloader.ClassLoaderSafeConnectorPageSourceProvider) RowExpressionService(com.facebook.presto.spi.relation.RowExpressionService) Injector(com.google.inject.Injector) AllowAllAccessControl(com.facebook.presto.plugin.base.security.AllowAllAccessControl) ThreadContextClassLoader(com.facebook.presto.spi.classloader.ThreadContextClassLoader) Bootstrap(com.facebook.airlift.bootstrap.Bootstrap) Procedure(com.facebook.presto.spi.procedure.Procedure) HiveMetastoreModule(com.facebook.presto.hive.metastore.HiveMetastoreModule) ThreadContextClassLoader(com.facebook.presto.spi.classloader.ThreadContextClassLoader) ClassLoaderSafeNodePartitioningProvider(com.facebook.presto.spi.connector.classloader.ClassLoaderSafeNodePartitioningProvider) ConnectorPlanOptimizer(com.facebook.presto.spi.ConnectorPlanOptimizer) HiveAuthenticationModule(com.facebook.presto.hive.authentication.HiveAuthenticationModule) ClassLoaderSafeConnectorPageSinkProvider(com.facebook.presto.spi.connector.classloader.ClassLoaderSafeConnectorPageSinkProvider) JsonModule(com.facebook.airlift.json.JsonModule) CachingModule(com.facebook.presto.cache.CachingModule) PageIndexerFactory(com.facebook.presto.spi.PageIndexerFactory) HiveS3Module(com.facebook.presto.hive.s3.HiveS3Module) NodeManager(com.facebook.presto.spi.NodeManager) LifeCycleManager(com.facebook.airlift.bootstrap.LifeCycleManager) ConnectorPageSinkProvider(com.facebook.presto.spi.connector.ConnectorPageSinkProvider) ClassLoaderSafeConnectorPageSinkProvider(com.facebook.presto.spi.connector.classloader.ClassLoaderSafeConnectorPageSinkProvider) ClassLoaderSafeConnectorSplitManager(com.facebook.presto.spi.connector.classloader.ClassLoaderSafeConnectorSplitManager) ConnectorSplitManager(com.facebook.presto.spi.connector.ConnectorSplitManager) ConnectorPageSourceProvider(com.facebook.presto.spi.connector.ConnectorPageSourceProvider) ClassLoaderSafeConnectorPageSourceProvider(com.facebook.presto.spi.connector.classloader.ClassLoaderSafeConnectorPageSourceProvider) ConnectorNodePartitioningProvider(com.facebook.presto.spi.connector.ConnectorNodePartitioningProvider) ClassLoaderSafeConnectorSplitManager(com.facebook.presto.spi.connector.classloader.ClassLoaderSafeConnectorSplitManager) TypeManager(com.facebook.presto.common.type.TypeManager) StandardFunctionResolution(com.facebook.presto.spi.function.StandardFunctionResolution)

Aggregations

Bootstrap (com.facebook.airlift.bootstrap.Bootstrap)1 LifeCycleManager (com.facebook.airlift.bootstrap.LifeCycleManager)1 EventModule (com.facebook.airlift.event.client.EventModule)1 JsonModule (com.facebook.airlift.json.JsonModule)1 CachingModule (com.facebook.presto.cache.CachingModule)1 TypeManager (com.facebook.presto.common.type.TypeManager)1 NodeVersion (com.facebook.presto.hive.NodeVersion)1 HiveAuthenticationModule (com.facebook.presto.hive.authentication.HiveAuthenticationModule)1 HiveMetastoreModule (com.facebook.presto.hive.metastore.HiveMetastoreModule)1 HiveS3Module (com.facebook.presto.hive.s3.HiveS3Module)1 AllowAllAccessControl (com.facebook.presto.plugin.base.security.AllowAllAccessControl)1 ConnectorPlanOptimizer (com.facebook.presto.spi.ConnectorPlanOptimizer)1 NodeManager (com.facebook.presto.spi.NodeManager)1 PageIndexerFactory (com.facebook.presto.spi.PageIndexerFactory)1 ThreadContextClassLoader (com.facebook.presto.spi.classloader.ThreadContextClassLoader)1 ConnectorNodePartitioningProvider (com.facebook.presto.spi.connector.ConnectorNodePartitioningProvider)1 ConnectorPageSinkProvider (com.facebook.presto.spi.connector.ConnectorPageSinkProvider)1 ConnectorPageSourceProvider (com.facebook.presto.spi.connector.ConnectorPageSourceProvider)1 ConnectorSplitManager (com.facebook.presto.spi.connector.ConnectorSplitManager)1 ClassLoaderSafeConnectorPageSinkProvider (com.facebook.presto.spi.connector.classloader.ClassLoaderSafeConnectorPageSinkProvider)1