Search in sources :

Example 1 with QueryRunner

use of io.prestosql.testing.QueryRunner 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)

Aggregations

ImmutableList (com.google.common.collect.ImmutableList)1 ImmutableMap (com.google.common.collect.ImmutableMap)1 ImmutableSet (com.google.common.collect.ImmutableSet)1 ThriftCodecManager (io.airlift.drift.codec.ThriftCodecManager)1 DriftServer (io.airlift.drift.server.DriftServer)1 DriftService (io.airlift.drift.server.DriftService)1 NullMethodInvocationStatsFactory (io.airlift.drift.server.stats.NullMethodInvocationStatsFactory)1 DriftNettyServerConfig (io.airlift.drift.transport.netty.server.DriftNettyServerConfig)1 DriftNettyServerTransport (io.airlift.drift.transport.netty.server.DriftNettyServerTransport)1 DriftNettyServerTransportFactory (io.airlift.drift.transport.netty.server.DriftNettyServerTransportFactory)1 Logger (io.airlift.log.Logger)1 Logging (io.airlift.log.Logging)1 Closeables.closeQuietly (io.airlift.testing.Closeables.closeQuietly)1 Session (io.prestosql.Session)1 StatsCalculator (io.prestosql.cost.StatsCalculator)1 Metadata (io.prestosql.metadata.Metadata)1 ThriftPlugin (io.prestosql.plugin.thrift.ThriftPlugin)1 ThriftIndexedTpchService (io.prestosql.plugin.thrift.server.ThriftIndexedTpchService)1 ThriftTpchService (io.prestosql.plugin.thrift.server.ThriftTpchService)1 TestingPrestoServer (io.prestosql.server.testing.TestingPrestoServer)1