Search in sources :

Example 1 with DriftServer

use of io.airlift.drift.server.DriftServer in project hetu-core by openlookeng.

the class ThriftQueryRunner method createThriftQueryRunnerInternal.

private static DistributedQueryRunner createThriftQueryRunnerInternal(List<DriftServer> servers, int nodeCount, Map<String, String> properties) throws Exception {
    String addresses = servers.stream().map(server -> "localhost:" + driftServerPort(server)).collect(joining(","));
    Session defaultSession = testSessionBuilder().setCatalog("thrift").setSchema("tiny").build();
    DistributedQueryRunner queryRunner = DistributedQueryRunner.builder(defaultSession).setNodeCount(nodeCount).setExtraProperties(properties).build();
    queryRunner.installPlugin(new ThriftPlugin());
    Map<String, String> connectorProperties = ImmutableMap.<String, String>builder().put("presto.thrift.client.addresses", addresses).put("presto.thrift.client.connect-timeout", "30s").put("presto-thrift.lookup-requests-concurrency", "2").build();
    queryRunner.createCatalog("thrift", "presto-thrift", connectorProperties);
    return queryRunner;
}
Also used : NullMethodInvocationStatsFactory(io.airlift.drift.server.stats.NullMethodInvocationStatsFactory) NodePartitioningManager(io.prestosql.sql.planner.NodePartitioningManager) Plugin(io.prestosql.spi.Plugin) Logger(io.airlift.log.Logger) TransactionManager(io.prestosql.transaction.TransactionManager) DriftService(io.airlift.drift.server.DriftService) MaterializedResult(io.prestosql.testing.MaterializedResult) QualifiedObjectName(io.prestosql.spi.connector.QualifiedObjectName) ArrayList(java.util.ArrayList) TestingSession.testSessionBuilder(io.prestosql.testing.TestingSession.testSessionBuilder) TestingAccessControlManager(io.prestosql.testing.TestingAccessControlManager) ConnectorPlanOptimizerManager(io.prestosql.sql.planner.ConnectorPlanOptimizerManager) ImmutableList(com.google.common.collect.ImmutableList) DriftNettyServerConfig(io.airlift.drift.transport.netty.server.DriftNettyServerConfig) ThriftIndexedTpchService(io.prestosql.plugin.thrift.server.ThriftIndexedTpchService) DistributedQueryRunner(io.prestosql.tests.DistributedQueryRunner) Map(java.util.Map) Objects.requireNonNull(java.util.Objects.requireNonNull) Logging(io.airlift.log.Logging) Session(io.prestosql.Session) PageSourceManager(io.prestosql.split.PageSourceManager) StatsCalculator(io.prestosql.cost.StatsCalculator) ImmutableSet(com.google.common.collect.ImmutableSet) ImmutableMap(com.google.common.collect.ImmutableMap) Closeables.closeQuietly(io.airlift.testing.Closeables.closeQuietly) ThriftPlugin(io.prestosql.plugin.thrift.ThriftPlugin) QueryRunner(io.prestosql.testing.QueryRunner) DriftServer(io.airlift.drift.server.DriftServer) TestingPrestoServer(io.prestosql.server.testing.TestingPrestoServer) Metadata(io.prestosql.metadata.Metadata) Collectors.joining(java.util.stream.Collectors.joining) ThriftCodecManager(io.airlift.drift.codec.ThriftCodecManager) List(java.util.List) Lock(java.util.concurrent.locks.Lock) ThriftTpchService(io.prestosql.plugin.thrift.server.ThriftTpchService) SplitManager(io.prestosql.split.SplitManager) DriftNettyServerTransportFactory(io.airlift.drift.transport.netty.server.DriftNettyServerTransportFactory) DriftNettyServerTransport(io.airlift.drift.transport.netty.server.DriftNettyServerTransport) DistributedQueryRunner(io.prestosql.tests.DistributedQueryRunner) ThriftPlugin(io.prestosql.plugin.thrift.ThriftPlugin) Session(io.prestosql.Session)

Example 2 with DriftServer

use of io.airlift.drift.server.DriftServer in project trino by trinodb.

the class ThriftQueryRunner method createThriftQueryRunnerInternal.

private static DistributedQueryRunner createThriftQueryRunnerInternal(List<DriftServer> servers, Map<String, String> properties) throws Exception {
    String addresses = servers.stream().map(server -> "localhost:" + driftServerPort(server)).collect(joining(","));
    Session defaultSession = testSessionBuilder().setCatalog("thrift").setSchema("tiny").build();
    DistributedQueryRunner queryRunner = DistributedQueryRunner.builder(defaultSession).setExtraProperties(properties).build();
    queryRunner.installPlugin(new ThriftPlugin());
    Map<String, String> connectorProperties = ImmutableMap.<String, String>builder().put("trino.thrift.client.addresses", addresses).put("trino.thrift.client.connect-timeout", "30s").put("trino-thrift.lookup-requests-concurrency", "2").buildOrThrow();
    queryRunner.createCatalog("thrift", "trino-thrift", connectorProperties);
    queryRunner.installPlugin(new TpchPlugin());
    queryRunner.createCatalog("tpch", "tpch");
    return queryRunner;
}
Also used : NullMethodInvocationStatsFactory(io.airlift.drift.server.stats.NullMethodInvocationStatsFactory) TestingGroupProvider(io.trino.testing.TestingGroupProvider) TransactionManager(io.trino.transaction.TransactionManager) MaterializedResult(io.trino.testing.MaterializedResult) DriftService(io.airlift.drift.server.DriftService) SplitManager(io.trino.split.SplitManager) StatsCalculator(io.trino.cost.StatsCalculator) ThriftTpchService(io.trino.plugin.thrift.server.ThriftTpchService) DistributedQueryRunner(io.trino.testing.DistributedQueryRunner) DriftNettyServerConfig(io.airlift.drift.transport.netty.server.DriftNettyServerConfig) ThriftIndexedTpchService(io.trino.plugin.thrift.server.ThriftIndexedTpchService) Map(java.util.Map) TestingAccessControlManager(io.trino.testing.TestingAccessControlManager) ErrorType(io.trino.spi.ErrorType) TpchPlugin(io.trino.plugin.tpch.TpchPlugin) TestingTrinoServer(io.trino.server.testing.TestingTrinoServer) ImmutableSet(com.google.common.collect.ImmutableSet) ImmutableMap(com.google.common.collect.ImmutableMap) InjectedFailureType(io.trino.execution.FailureInjector.InjectedFailureType) Collectors.joining(java.util.stream.Collectors.joining) SessionPropertyManager(io.trino.metadata.SessionPropertyManager) Plugin(io.trino.spi.Plugin) List(java.util.List) TestingSession.testSessionBuilder(io.trino.testing.TestingSession.testSessionBuilder) DriftNettyServerTransportFactory(io.airlift.drift.transport.netty.server.DriftNettyServerTransportFactory) DriftNettyServerTransport(io.airlift.drift.transport.netty.server.DriftNettyServerTransport) Optional(java.util.Optional) Session(io.trino.Session) ThriftPlugin(io.trino.plugin.thrift.ThriftPlugin) Logger(io.airlift.log.Logger) NodePartitioningManager(io.trino.sql.planner.NodePartitioningManager) ArrayList(java.util.ArrayList) ImmutableList(com.google.common.collect.ImmutableList) Closer(com.google.common.io.Closer) QueryExplainer(io.trino.sql.analyzer.QueryExplainer) Objects.requireNonNull(java.util.Objects.requireNonNull) Logging(io.airlift.log.Logging) Closeables.closeAllSuppress(io.airlift.testing.Closeables.closeAllSuppress) DriftServer(io.airlift.drift.server.DriftServer) IOException(java.io.IOException) PageSourceManager(io.trino.split.PageSourceManager) FunctionManager(io.trino.metadata.FunctionManager) FunctionBundle(io.trino.metadata.FunctionBundle) ThriftCodecManager(io.airlift.drift.codec.ThriftCodecManager) Lock(java.util.concurrent.locks.Lock) QualifiedObjectName(io.trino.metadata.QualifiedObjectName) QueryRunner(io.trino.testing.QueryRunner) Metadata(io.trino.metadata.Metadata) TypeManager(io.trino.spi.type.TypeManager) DistributedQueryRunner(io.trino.testing.DistributedQueryRunner) ThriftPlugin(io.trino.plugin.thrift.ThriftPlugin) TpchPlugin(io.trino.plugin.tpch.TpchPlugin) Session(io.trino.Session)

Example 3 with DriftServer

use of io.airlift.drift.server.DriftServer in project trino by trinodb.

the class ThriftQueryRunner method startThriftServers.

static List<DriftServer> startThriftServers(int thriftServers, boolean enableIndexJoin) {
    List<DriftServer> servers = new ArrayList<>(thriftServers);
    for (int i = 0; i < thriftServers; i++) {
        ThriftTpchService service = enableIndexJoin ? new ThriftIndexedTpchService() : new ThriftTpchService();
        DriftServer server = new DriftServer(new DriftNettyServerTransportFactory(new DriftNettyServerConfig()), CODEC_MANAGER, new NullMethodInvocationStatsFactory(), ImmutableSet.of(new DriftService(service)), ImmutableSet.of());
        server.start();
        servers.add(server);
    }
    return servers;
}
Also used : ThriftTpchService(io.trino.plugin.thrift.server.ThriftTpchService) DriftNettyServerConfig(io.airlift.drift.transport.netty.server.DriftNettyServerConfig) DriftService(io.airlift.drift.server.DriftService) ThriftIndexedTpchService(io.trino.plugin.thrift.server.ThriftIndexedTpchService) ArrayList(java.util.ArrayList) NullMethodInvocationStatsFactory(io.airlift.drift.server.stats.NullMethodInvocationStatsFactory) DriftServer(io.airlift.drift.server.DriftServer) DriftNettyServerTransportFactory(io.airlift.drift.transport.netty.server.DriftNettyServerTransportFactory)

Example 4 with DriftServer

use of io.airlift.drift.server.DriftServer in project hetu-core by openlookeng.

the class ThriftQueryRunner method createThriftQueryRunner.

public static QueryRunner createThriftQueryRunner(int thriftServers, int nodeCount, boolean enableIndexJoin, Map<String, String> properties) throws Exception {
    List<DriftServer> servers = null;
    DistributedQueryRunner runner = null;
    try {
        servers = startThriftServers(thriftServers, enableIndexJoin);
        runner = createThriftQueryRunnerInternal(servers, nodeCount, properties);
        return new ThriftQueryRunnerWithServers(runner, servers);
    } catch (Throwable t) {
        closeQuietly(runner);
        // runner might be null, so closing servers explicitly
        if (servers != null) {
            for (DriftServer server : servers) {
                server.shutdown();
            }
        }
        throw t;
    }
}
Also used : DistributedQueryRunner(io.prestosql.tests.DistributedQueryRunner) DriftServer(io.airlift.drift.server.DriftServer)

Example 5 with DriftServer

use of io.airlift.drift.server.DriftServer in project hetu-core by openlookeng.

the class ThriftQueryRunner method startThriftServers.

private static List<DriftServer> startThriftServers(int thriftServers, boolean enableIndexJoin) {
    List<DriftServer> servers = new ArrayList<>(thriftServers);
    for (int i = 0; i < thriftServers; i++) {
        ThriftTpchService service = enableIndexJoin ? new ThriftIndexedTpchService() : new ThriftTpchService();
        DriftServer server = new DriftServer(new DriftNettyServerTransportFactory(new DriftNettyServerConfig()), CODEC_MANAGER, new NullMethodInvocationStatsFactory(), ImmutableSet.of(new DriftService(service)), ImmutableSet.of());
        server.start();
        servers.add(server);
    }
    return servers;
}
Also used : ThriftTpchService(io.prestosql.plugin.thrift.server.ThriftTpchService) DriftNettyServerConfig(io.airlift.drift.transport.netty.server.DriftNettyServerConfig) DriftService(io.airlift.drift.server.DriftService) ThriftIndexedTpchService(io.prestosql.plugin.thrift.server.ThriftIndexedTpchService) ArrayList(java.util.ArrayList) NullMethodInvocationStatsFactory(io.airlift.drift.server.stats.NullMethodInvocationStatsFactory) DriftServer(io.airlift.drift.server.DriftServer) DriftNettyServerTransportFactory(io.airlift.drift.transport.netty.server.DriftNettyServerTransportFactory)

Aggregations

DriftServer (io.airlift.drift.server.DriftServer)6 DriftService (io.airlift.drift.server.DriftService)4 NullMethodInvocationStatsFactory (io.airlift.drift.server.stats.NullMethodInvocationStatsFactory)4 DriftNettyServerConfig (io.airlift.drift.transport.netty.server.DriftNettyServerConfig)4 DriftNettyServerTransportFactory (io.airlift.drift.transport.netty.server.DriftNettyServerTransportFactory)4 ArrayList (java.util.ArrayList)4 ImmutableList (com.google.common.collect.ImmutableList)2 ImmutableMap (com.google.common.collect.ImmutableMap)2 ImmutableSet (com.google.common.collect.ImmutableSet)2 ThriftCodecManager (io.airlift.drift.codec.ThriftCodecManager)2 DriftNettyServerTransport (io.airlift.drift.transport.netty.server.DriftNettyServerTransport)2 Logger (io.airlift.log.Logger)2 Logging (io.airlift.log.Logging)2 ThriftIndexedTpchService (io.prestosql.plugin.thrift.server.ThriftIndexedTpchService)2 ThriftTpchService (io.prestosql.plugin.thrift.server.ThriftTpchService)2 ThriftIndexedTpchService (io.trino.plugin.thrift.server.ThriftIndexedTpchService)2 ThriftTpchService (io.trino.plugin.thrift.server.ThriftTpchService)2 List (java.util.List)2 Map (java.util.Map)2 Objects.requireNonNull (java.util.Objects.requireNonNull)2