Search in sources :

Example 1 with HiveS3Module

use of io.prestosql.plugin.hive.s3.HiveS3Module in project presto by prestodb.

the class DeltaConnectorFactory method create.

@Override
public Connector create(String catalogName, Map<String, String> requiredConfig, ConnectorContext context) {
    requireNonNull(requiredConfig, "requiredConfig is null");
    try {
        Bootstrap app = new Bootstrap(new JsonModule(), new DeltaModule(catalogName, context.getTypeManager()), new HiveS3Module(catalogName), new HiveGcsModule(), new HiveAuthenticationModule(), new HiveMetastoreModule(catalogName, Optional.empty()), binder -> {
            binder.bind(RowExpressionService.class).toInstance(context.getRowExpressionService());
        });
        Injector injector = app.doNotInitializeLogging().setRequiredConfigurationProperties(requiredConfig).initialize();
        return injector.getInstance(DeltaConnector.class);
    } catch (Exception exception) {
        throwIfUnchecked(exception);
        throw new RuntimeException(exception);
    }
}
Also used : HiveS3Module(com.facebook.presto.hive.s3.HiveS3Module) HiveGcsModule(com.facebook.presto.hive.gcs.HiveGcsModule) RowExpressionService(com.facebook.presto.spi.relation.RowExpressionService) Injector(com.google.inject.Injector) HiveAuthenticationModule(com.facebook.presto.hive.authentication.HiveAuthenticationModule) Bootstrap(com.facebook.airlift.bootstrap.Bootstrap) HiveMetastoreModule(com.facebook.presto.hive.metastore.HiveMetastoreModule) JsonModule(com.facebook.airlift.json.JsonModule)

Example 2 with HiveS3Module

use of io.prestosql.plugin.hive.s3.HiveS3Module in project presto by prestodb.

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 JsonModule(), new SmileModule(), new HiveClientModule(catalogName), new HiveS3Module(catalogName), new HiveGcsModule(), new HiveMetastoreModule(catalogName, metastore), new HiveSecurityModule(), new HiveAuthenticationModule(), new HiveProcedureModule(), new CachingModule(), binder -> {
            MBeanServer platformMBeanServer = ManagementFactory.getPlatformMBeanServer();
            binder.bind(MBeanServer.class).toInstance(new RebindSafeMBeanServer(platformMBeanServer));
            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(PageSorter.class).toInstance(context.getPageSorter());
            binder.bind(StandardFunctionResolution.class).toInstance(context.getStandardFunctionResolution());
            binder.bind(FunctionMetadataManager.class).toInstance(context.getFunctionMetadataManager());
            binder.bind(RowExpressionService.class).toInstance(context.getRowExpressionService());
            binder.bind(FilterStatsCalculatorService.class).toInstance(context.getFilterStatsCalculatorService());
            binder.bind(BlockEncodingSerde.class).toInstance(context.getBlockEncodingSerde());
        });
        Injector injector = app.doNotInitializeLogging().setRequiredConfigurationProperties(config).quiet().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);
        ConnectorMetadataUpdaterProvider metadataUpdaterProvider = injector.getInstance(ConnectorMetadataUpdaterProvider.class);
        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, metadataUpdaterProvider, classLoader);
    } catch (Exception e) {
        throwIfUnchecked(e);
        throw new RuntimeException(e);
    }
}
Also used : FilterStatsCalculatorService(com.facebook.presto.spi.plan.FilterStatsCalculatorService) ClassLoaderSafeConnectorPageSourceProvider(com.facebook.presto.spi.connector.classloader.ClassLoaderSafeConnectorPageSourceProvider) Injector(com.google.inject.Injector) PageSorter(com.facebook.presto.spi.PageSorter) Procedure(com.facebook.presto.spi.procedure.Procedure) HiveMetastoreModule(com.facebook.presto.hive.metastore.HiveMetastoreModule) ClassLoaderSafeNodePartitioningProvider(com.facebook.presto.spi.connector.classloader.ClassLoaderSafeNodePartitioningProvider) MBeanServer(javax.management.MBeanServer) ConnectorAccessControl(com.facebook.presto.spi.connector.ConnectorAccessControl) ClassLoaderSafeConnectorPageSinkProvider(com.facebook.presto.spi.connector.classloader.ClassLoaderSafeConnectorPageSinkProvider) JsonModule(com.facebook.airlift.json.JsonModule) PageIndexerFactory(com.facebook.presto.spi.PageIndexerFactory) NodeManager(com.facebook.presto.spi.NodeManager) LifeCycleManager(com.facebook.airlift.bootstrap.LifeCycleManager) ConnectorSplitManager(com.facebook.presto.spi.connector.ConnectorSplitManager) ClassLoaderSafeConnectorSplitManager(com.facebook.presto.spi.connector.classloader.ClassLoaderSafeConnectorSplitManager) SystemTableAwareAccessControl(com.facebook.presto.hive.security.SystemTableAwareAccessControl) MBeanModule(org.weakref.jmx.guice.MBeanModule) ConnectorPlanOptimizerProvider(com.facebook.presto.spi.connector.ConnectorPlanOptimizerProvider) EventModule(com.facebook.airlift.event.client.EventModule) TypeLiteral(com.google.inject.TypeLiteral) RowExpressionService(com.facebook.presto.spi.relation.RowExpressionService) HiveSecurityModule(com.facebook.presto.hive.security.HiveSecurityModule) Bootstrap(com.facebook.airlift.bootstrap.Bootstrap) ThreadContextClassLoader(com.facebook.presto.spi.classloader.ThreadContextClassLoader) ConnectorMetadataUpdaterProvider(com.facebook.presto.spi.connector.ConnectorMetadataUpdaterProvider) HiveAuthenticationModule(com.facebook.presto.hive.authentication.HiveAuthenticationModule) BlockEncodingSerde(com.facebook.presto.common.block.BlockEncodingSerde) CachingModule(com.facebook.presto.cache.CachingModule) FunctionMetadataManager(com.facebook.presto.spi.function.FunctionMetadataManager) HiveS3Module(com.facebook.presto.hive.s3.HiveS3Module) ClassLoaderSafeConnectorPageSinkProvider(com.facebook.presto.spi.connector.classloader.ClassLoaderSafeConnectorPageSinkProvider) ConnectorPageSinkProvider(com.facebook.presto.spi.connector.ConnectorPageSinkProvider) HiveGcsModule(com.facebook.presto.hive.gcs.HiveGcsModule) ConnectorPageSourceProvider(com.facebook.presto.spi.connector.ConnectorPageSourceProvider) ClassLoaderSafeConnectorPageSourceProvider(com.facebook.presto.spi.connector.classloader.ClassLoaderSafeConnectorPageSourceProvider) SmileModule(com.facebook.airlift.json.smile.SmileModule) 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)

Example 3 with HiveS3Module

use of io.prestosql.plugin.hive.s3.HiveS3Module 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)

Example 4 with HiveS3Module

use of io.prestosql.plugin.hive.s3.HiveS3Module in project carbondata by apache.

the class CarbondataConnectorFactory 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 JsonModule(), new CarbondataModule(catalogName), new HiveS3Module(catalogName), new HiveMetastoreModule(catalogName, Optional.ofNullable(null)), new HiveSecurityModule(), new HiveAuthenticationModule(), new HiveProcedureModule(), binder -> {
            javax.management.MBeanServer platformMBeanServer = ManagementFactory.getPlatformMBeanServer();
            binder.bind(javax.management.MBeanServer.class).toInstance(new RebindSafeMBeanServer(platformMBeanServer));
            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(PageSorter.class).toInstance(context.getPageSorter());
            configBinder(binder).bindConfig(CarbonTableConfig.class);
        });
        Injector injector = app.strictConfig().doNotInitializeLogging().setRequiredConfigurationProperties(config).initialize();
        setCarbonEnum();
        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 PartitionsAwareAccessControl(injector.getInstance(ConnectorAccessControl.class));
        Set<Procedure> procedures = injector.getInstance(Key.get(new TypeLiteral<Set<Procedure>>() {
        }));
        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, classLoader);
    } catch (Exception e) {
        throwIfUnchecked(e);
        throw new RuntimeException(e);
    }
}
Also used : HiveProcedureModule(com.facebook.presto.hive.HiveProcedureModule) MBeanModule(org.weakref.jmx.guice.MBeanModule) HiveMetadataFactory(com.facebook.presto.hive.HiveMetadataFactory) EventModule(io.airlift.event.client.EventModule) HiveSessionProperties(com.facebook.presto.hive.HiveSessionProperties) NodeVersion(com.facebook.presto.hive.NodeVersion) ClassLoaderSafeConnectorPageSourceProvider(com.facebook.presto.spi.connector.classloader.ClassLoaderSafeConnectorPageSourceProvider) TypeLiteral(com.google.inject.TypeLiteral) RebindSafeMBeanServer(com.facebook.presto.hive.RebindSafeMBeanServer) Injector(com.google.inject.Injector) HiveSecurityModule(com.facebook.presto.hive.security.HiveSecurityModule) Bootstrap(io.airlift.bootstrap.Bootstrap) PageSorter(com.facebook.presto.spi.PageSorter) Procedure(com.facebook.presto.spi.procedure.Procedure) HiveMetastoreModule(com.facebook.presto.hive.metastore.HiveMetastoreModule) HiveConnector(com.facebook.presto.hive.HiveConnector) ThreadContextClassLoader(com.facebook.presto.spi.classloader.ThreadContextClassLoader) HiveAnalyzeProperties(com.facebook.presto.hive.HiveAnalyzeProperties) ClassLoaderSafeNodePartitioningProvider(com.facebook.presto.spi.connector.classloader.ClassLoaderSafeNodePartitioningProvider) RebindSafeMBeanServer(com.facebook.presto.hive.RebindSafeMBeanServer) ConnectorAccessControl(com.facebook.presto.spi.connector.ConnectorAccessControl) HiveTableProperties(com.facebook.presto.hive.HiveTableProperties) PartitionsAwareAccessControl(com.facebook.presto.hive.security.PartitionsAwareAccessControl) HiveAuthenticationModule(com.facebook.presto.hive.authentication.HiveAuthenticationModule) ClassLoaderSafeConnectorPageSinkProvider(com.facebook.presto.spi.connector.classloader.ClassLoaderSafeConnectorPageSinkProvider) JsonModule(io.airlift.json.JsonModule) PageIndexerFactory(com.facebook.presto.spi.PageIndexerFactory) HiveS3Module(com.facebook.presto.hive.s3.HiveS3Module) NodeManager(com.facebook.presto.spi.NodeManager) LifeCycleManager(io.airlift.bootstrap.LifeCycleManager) ClassLoaderSafeConnectorPageSinkProvider(com.facebook.presto.spi.connector.classloader.ClassLoaderSafeConnectorPageSinkProvider) ConnectorPageSinkProvider(com.facebook.presto.spi.connector.ConnectorPageSinkProvider) ConnectorSplitManager(com.facebook.presto.spi.connector.ConnectorSplitManager) ClassLoaderSafeConnectorSplitManager(com.facebook.presto.spi.connector.classloader.ClassLoaderSafeConnectorSplitManager) 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.spi.type.TypeManager) HiveTransactionManager(com.facebook.presto.hive.HiveTransactionManager)

Example 5 with HiveS3Module

use of io.prestosql.plugin.hive.s3.HiveS3Module in project carbondata by apache.

the class InternalCarbonDataConnectorFactory method createConnector.

public static Connector createConnector(String catalogName, Map<String, String> config, ConnectorContext context, Module module, Optional<HiveMetastore> metastore) {
    requireNonNull(config, "config is null");
    ClassLoader classLoader = InternalCarbonDataConnectorFactory.class.getClassLoader();
    try (ThreadContextClassLoader ignored = new ThreadContextClassLoader(classLoader)) {
        Bootstrap app = new Bootstrap(new EventModule(), new MBeanModule(), new ConnectorObjectNameGeneratorModule(catalogName, "io.prestosql.plugin.carbondata", "presto.plugin.carbondata"), new JsonModule(), new CarbondataModule(), new HiveS3Module(), new HiveGcsModule(), new HiveAzureModule(), installModuleIf(RubixEnabledConfig.class, RubixEnabledConfig::isCacheEnabled, new RubixModule()), new HiveMetastoreModule(metastore), new HiveSecurityModule(catalogName), 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(CatalogName.class).toInstance(new CatalogName(catalogName));
            configBinder(binder).bindConfig(CarbonTableConfig.class);
        }, binder -> newSetBinder(binder, EventListener.class), module);
        Injector injector = app.strictConfig().doNotInitializeLogging().setRequiredConfigurationProperties(config).initialize();
        if (injector.getInstance(RubixEnabledConfig.class).isCacheEnabled()) {
            // RubixInitializer needs ConfigurationInitializers, hence kept outside RubixModule
            RubixInitializer rubixInitializer = injector.getInstance(RubixInitializer.class);
            rubixInitializer.initializeRubix(context.getNodeManager());
        }
        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 ClassLoaderSafeConnectorAccessControl(new SystemTableAwareAccessControl(injector.getInstance(ConnectorAccessControl.class)), classLoader);
        Set<Procedure> procedures = injector.getInstance(Key.get(new TypeLiteral<Set<Procedure>>() {
        }));
        Set<SystemTable> systemTables = injector.getInstance(Key.get(new TypeLiteral<Set<SystemTable>>() {
        }));
        Set<EventListener> eventListeners = injector.getInstance(Key.get(new TypeLiteral<Set<EventListener>>() {
        })).stream().map(listener -> new ClassLoaderSafeEventListener(listener, classLoader)).collect(toImmutableSet());
        return new CarbonDataConnector(lifeCycleManager, metadataFactory, transactionManager, new ClassLoaderSafeConnectorSplitManager(splitManager, classLoader), new ClassLoaderSafeConnectorPageSourceProvider(connectorPageSource, classLoader), new ClassLoaderSafeConnectorPageSinkProvider(pageSinkProvider, classLoader), new ClassLoaderSafeNodePartitioningProvider(connectorDistributionProvider, classLoader), systemTables, procedures, eventListeners, hiveSessionProperties.getSessionProperties(), HiveSchemaProperties.SCHEMA_PROPERTIES, hiveTableProperties.getTableProperties(), hiveAnalyzeProperties.getAnalyzeProperties(), accessControl, classLoader);
    }
}
Also used : HiveProcedureModule(io.prestosql.plugin.hive.procedure.HiveProcedureModule) Module(com.google.inject.Module) VersionEmbedder(io.prestosql.spi.VersionEmbedder) ConnectorAccessControl(io.prestosql.spi.connector.ConnectorAccessControl) MBeanModule(org.weakref.jmx.guice.MBeanModule) HiveProcedureModule(io.prestosql.plugin.hive.procedure.HiveProcedureModule) HiveAnalyzeProperties(io.prestosql.plugin.hive.HiveAnalyzeProperties) ConnectorSplitManager(io.prestosql.spi.connector.ConnectorSplitManager) Key(com.google.inject.Key) RubixModule(io.prestosql.plugin.hive.rubix.RubixModule) HiveSecurityModule(io.prestosql.plugin.hive.security.HiveSecurityModule) HiveS3Module(io.prestosql.plugin.hive.s3.HiveS3Module) HiveMetadataFactory(io.prestosql.plugin.hive.HiveMetadataFactory) HiveAuthenticationModule(io.prestosql.plugin.hive.authentication.HiveAuthenticationModule) Procedure(io.prestosql.spi.procedure.Procedure) CarbonTableConfig(org.apache.carbondata.presto.impl.CarbonTableConfig) NodeVersion(io.prestosql.plugin.hive.NodeVersion) SystemTableAwareAccessControl(io.prestosql.plugin.hive.security.SystemTableAwareAccessControl) ConnectorNodePartitioningProvider(io.prestosql.spi.connector.ConnectorNodePartitioningProvider) Map(java.util.Map) Multibinder.newSetBinder(com.google.inject.multibindings.Multibinder.newSetBinder) ConnectorPageSinkProvider(io.prestosql.spi.connector.ConnectorPageSinkProvider) HiveGcsModule(io.prestosql.plugin.hive.gcs.HiveGcsModule) PageIndexerFactory(io.prestosql.spi.PageIndexerFactory) ConditionalModule.installModuleIf(io.airlift.configuration.ConditionalModule.installModuleIf) SystemTable(io.prestosql.spi.connector.SystemTable) HiveMetastoreModule(io.prestosql.plugin.hive.metastore.HiveMetastoreModule) LifeCycleManager(io.airlift.bootstrap.LifeCycleManager) Set(java.util.Set) ClassLoaderSafeConnectorPageSourceProvider(io.prestosql.plugin.base.classloader.ClassLoaderSafeConnectorPageSourceProvider) ClassLoaderSafeConnectorAccessControl(io.prestosql.plugin.base.classloader.ClassLoaderSafeConnectorAccessControl) Bootstrap(io.airlift.bootstrap.Bootstrap) Optional(java.util.Optional) ConfigBinder.configBinder(io.airlift.configuration.ConfigBinder.configBinder) TypeLiteral(com.google.inject.TypeLiteral) ClassLoaderSafeConnectorSplitManager(io.prestosql.plugin.base.classloader.ClassLoaderSafeConnectorSplitManager) Connector(io.prestosql.spi.connector.Connector) HiveSessionProperties(io.prestosql.plugin.hive.HiveSessionProperties) ConnectorContext(io.prestosql.spi.connector.ConnectorContext) ClassLoaderSafeNodePartitioningProvider(io.prestosql.plugin.base.classloader.ClassLoaderSafeNodePartitioningProvider) EventModule(io.airlift.event.client.EventModule) HiveTransactionManager(io.prestosql.plugin.hive.HiveTransactionManager) ConnectorObjectNameGeneratorModule(io.prestosql.plugin.base.jmx.ConnectorObjectNameGeneratorModule) RubixEnabledConfig(io.prestosql.plugin.hive.rubix.RubixEnabledConfig) Objects.requireNonNull(java.util.Objects.requireNonNull) ImmutableSet.toImmutableSet(com.google.common.collect.ImmutableSet.toImmutableSet) RubixInitializer(io.prestosql.plugin.hive.rubix.RubixInitializer) HiveMetastore(io.prestosql.plugin.hive.metastore.HiveMetastore) CatalogName(io.prestosql.plugin.base.CatalogName) HiveSchemaProperties(io.prestosql.plugin.hive.HiveSchemaProperties) MBeanServerModule(io.prestosql.plugin.base.jmx.MBeanServerModule) HiveTableProperties(io.prestosql.plugin.hive.HiveTableProperties) HiveAzureModule(io.prestosql.plugin.hive.azure.HiveAzureModule) TypeManager(io.prestosql.spi.type.TypeManager) ThreadContextClassLoader(io.prestosql.spi.classloader.ThreadContextClassLoader) PageSorter(io.prestosql.spi.PageSorter) Injector(com.google.inject.Injector) ClassLoaderSafeConnectorPageSinkProvider(io.prestosql.plugin.base.classloader.ClassLoaderSafeConnectorPageSinkProvider) EventListener(io.prestosql.spi.eventlistener.EventListener) NodeManager(io.prestosql.spi.NodeManager) ClassLoaderSafeEventListener(io.prestosql.plugin.base.classloader.ClassLoaderSafeEventListener) ConnectorPageSourceProvider(io.prestosql.spi.connector.ConnectorPageSourceProvider) JsonModule(io.airlift.json.JsonModule) ClassLoaderSafeEventListener(io.prestosql.plugin.base.classloader.ClassLoaderSafeEventListener) NodeVersion(io.prestosql.plugin.hive.NodeVersion) ClassLoaderSafeConnectorPageSourceProvider(io.prestosql.plugin.base.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) HiveAnalyzeProperties(io.prestosql.plugin.hive.HiveAnalyzeProperties) ClassLoaderSafeNodePartitioningProvider(io.prestosql.plugin.base.classloader.ClassLoaderSafeNodePartitioningProvider) ConnectorAccessControl(io.prestosql.spi.connector.ConnectorAccessControl) ClassLoaderSafeConnectorAccessControl(io.prestosql.plugin.base.classloader.ClassLoaderSafeConnectorAccessControl) RubixModule(io.prestosql.plugin.hive.rubix.RubixModule) ClassLoaderSafeConnectorPageSinkProvider(io.prestosql.plugin.base.classloader.ClassLoaderSafeConnectorPageSinkProvider) JsonModule(io.airlift.json.JsonModule) PageIndexerFactory(io.prestosql.spi.PageIndexerFactory) NodeManager(io.prestosql.spi.NodeManager) LifeCycleManager(io.airlift.bootstrap.LifeCycleManager) ConnectorSplitManager(io.prestosql.spi.connector.ConnectorSplitManager) ClassLoaderSafeConnectorSplitManager(io.prestosql.plugin.base.classloader.ClassLoaderSafeConnectorSplitManager) SystemTableAwareAccessControl(io.prestosql.plugin.hive.security.SystemTableAwareAccessControl) ClassLoaderSafeConnectorAccessControl(io.prestosql.plugin.base.classloader.ClassLoaderSafeConnectorAccessControl) MBeanModule(org.weakref.jmx.guice.MBeanModule) HiveMetadataFactory(io.prestosql.plugin.hive.HiveMetadataFactory) Set(java.util.Set) ImmutableSet.toImmutableSet(com.google.common.collect.ImmutableSet.toImmutableSet) EventModule(io.airlift.event.client.EventModule) ConnectorObjectNameGeneratorModule(io.prestosql.plugin.base.jmx.ConnectorObjectNameGeneratorModule) HiveSessionProperties(io.prestosql.plugin.hive.HiveSessionProperties) TypeLiteral(com.google.inject.TypeLiteral) RubixInitializer(io.prestosql.plugin.hive.rubix.RubixInitializer) HiveSecurityModule(io.prestosql.plugin.hive.security.HiveSecurityModule) ThreadContextClassLoader(io.prestosql.spi.classloader.ThreadContextClassLoader) Bootstrap(io.airlift.bootstrap.Bootstrap) EventListener(io.prestosql.spi.eventlistener.EventListener) ClassLoaderSafeEventListener(io.prestosql.plugin.base.classloader.ClassLoaderSafeEventListener) ThreadContextClassLoader(io.prestosql.spi.classloader.ThreadContextClassLoader) HiveAzureModule(io.prestosql.plugin.hive.azure.HiveAzureModule) HiveTableProperties(io.prestosql.plugin.hive.HiveTableProperties) HiveAuthenticationModule(io.prestosql.plugin.hive.authentication.HiveAuthenticationModule) RubixEnabledConfig(io.prestosql.plugin.hive.rubix.RubixEnabledConfig) VersionEmbedder(io.prestosql.spi.VersionEmbedder) HiveS3Module(io.prestosql.plugin.hive.s3.HiveS3Module) ConnectorPageSinkProvider(io.prestosql.spi.connector.ConnectorPageSinkProvider) ClassLoaderSafeConnectorPageSinkProvider(io.prestosql.plugin.base.classloader.ClassLoaderSafeConnectorPageSinkProvider) HiveGcsModule(io.prestosql.plugin.hive.gcs.HiveGcsModule) ClassLoaderSafeConnectorPageSourceProvider(io.prestosql.plugin.base.classloader.ClassLoaderSafeConnectorPageSourceProvider) ConnectorPageSourceProvider(io.prestosql.spi.connector.ConnectorPageSourceProvider) MBeanServerModule(io.prestosql.plugin.base.jmx.MBeanServerModule) ConnectorNodePartitioningProvider(io.prestosql.spi.connector.ConnectorNodePartitioningProvider) ClassLoaderSafeConnectorSplitManager(io.prestosql.plugin.base.classloader.ClassLoaderSafeConnectorSplitManager) TypeManager(io.prestosql.spi.type.TypeManager) CatalogName(io.prestosql.plugin.base.CatalogName) SystemTable(io.prestosql.spi.connector.SystemTable) HiveTransactionManager(io.prestosql.plugin.hive.HiveTransactionManager)

Aggregations

Injector (com.google.inject.Injector)5 HiveAuthenticationModule (com.facebook.presto.hive.authentication.HiveAuthenticationModule)4 HiveMetastoreModule (com.facebook.presto.hive.metastore.HiveMetastoreModule)4 HiveS3Module (com.facebook.presto.hive.s3.HiveS3Module)4 MBeanModule (org.weakref.jmx.guice.MBeanModule)4 Bootstrap (com.facebook.airlift.bootstrap.Bootstrap)3 JsonModule (com.facebook.airlift.json.JsonModule)3 NodeManager (com.facebook.presto.spi.NodeManager)3 PageIndexerFactory (com.facebook.presto.spi.PageIndexerFactory)3 ThreadContextClassLoader (com.facebook.presto.spi.classloader.ThreadContextClassLoader)3 ConnectorNodePartitioningProvider (com.facebook.presto.spi.connector.ConnectorNodePartitioningProvider)3 ConnectorPageSinkProvider (com.facebook.presto.spi.connector.ConnectorPageSinkProvider)3 ConnectorPageSourceProvider (com.facebook.presto.spi.connector.ConnectorPageSourceProvider)3 ConnectorSplitManager (com.facebook.presto.spi.connector.ConnectorSplitManager)3 ClassLoaderSafeConnectorPageSinkProvider (com.facebook.presto.spi.connector.classloader.ClassLoaderSafeConnectorPageSinkProvider)3 ClassLoaderSafeConnectorPageSourceProvider (com.facebook.presto.spi.connector.classloader.ClassLoaderSafeConnectorPageSourceProvider)3 ClassLoaderSafeConnectorSplitManager (com.facebook.presto.spi.connector.classloader.ClassLoaderSafeConnectorSplitManager)3 ClassLoaderSafeNodePartitioningProvider (com.facebook.presto.spi.connector.classloader.ClassLoaderSafeNodePartitioningProvider)3 Procedure (com.facebook.presto.spi.procedure.Procedure)3 RowExpressionService (com.facebook.presto.spi.relation.RowExpressionService)3