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;
}
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;
}
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;
}
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;
}
}
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;
}
Aggregations