Search in sources :

Example 1 with TestingPrestoClient

use of io.prestosql.tests.TestingPrestoClient in project hetu-core by openlookeng.

the class KafkaQueryRunner method createKafkaQueryRunner.

public static DistributedQueryRunner createKafkaQueryRunner(EmbeddedKafka embeddedKafka, Iterable<TpchTable<?>> tables) throws Exception {
    DistributedQueryRunner queryRunner = null;
    try {
        queryRunner = new DistributedQueryRunner(createSession(), 2);
        queryRunner.installPlugin(new TpchPlugin());
        queryRunner.createCatalog("tpch", "tpch");
        embeddedKafka.start();
        for (TpchTable<?> table : tables) {
            embeddedKafka.createTopics(kafkaTopicName(table));
        }
        Map<SchemaTableName, KafkaTopicDescription> topicDescriptions = createTpchTopicDescriptions(queryRunner.getCoordinator().getMetadata(), tables);
        installKafkaPlugin(embeddedKafka, queryRunner, topicDescriptions);
        TestingPrestoClient prestoClient = queryRunner.getClient();
        log.info("Loading data...");
        long startTime = System.nanoTime();
        for (TpchTable<?> table : tables) {
            loadTpchTopic(embeddedKafka, prestoClient, table);
        }
        log.info("Loading complete in %s", nanosSince(startTime).toString(SECONDS));
        return queryRunner;
    } catch (Throwable e) {
        closeAllSuppress(e, queryRunner, embeddedKafka);
        throw e;
    }
}
Also used : TestingPrestoClient(io.prestosql.tests.TestingPrestoClient) DistributedQueryRunner(io.prestosql.tests.DistributedQueryRunner) TpchPlugin(io.prestosql.plugin.tpch.TpchPlugin) SchemaTableName(io.prestosql.spi.connector.SchemaTableName)

Example 2 with TestingPrestoClient

use of io.prestosql.tests.TestingPrestoClient in project hetu-core by openlookeng.

the class ElasticsearchQueryRunner method createElasticsearchQueryRunner.

public static DistributedQueryRunner createElasticsearchQueryRunner(EmbeddedElasticsearchNode embeddedElasticsearchNode, Iterable<TpchTable<?>> tables) throws Exception {
    DistributedQueryRunner queryRunner = null;
    try {
        queryRunner = DistributedQueryRunner.builder(createSession()).setNodeCount(NODE_COUNT).build();
        queryRunner.installPlugin(new TpchPlugin());
        queryRunner.createCatalog("tpch", "tpch");
        embeddedElasticsearchNode.start();
        TestingElasticsearchConnectorFactory testFactory = new TestingElasticsearchConnectorFactory();
        installElasticsearchPlugin(queryRunner, testFactory);
        TestingPrestoClient prestoClient = queryRunner.getClient();
        LOG.info("Loading data...");
        long startTime = System.nanoTime();
        for (TpchTable<?> table : tables) {
            loadTpchTopic(embeddedElasticsearchNode, prestoClient, table);
        }
        LOG.info("Loading complete in %s", nanosSince(startTime).toString(SECONDS));
        return queryRunner;
    } catch (Exception e) {
        closeAllSuppress(e, queryRunner, embeddedElasticsearchNode);
        throw e;
    }
}
Also used : TestingPrestoClient(io.prestosql.tests.TestingPrestoClient) DistributedQueryRunner(io.prestosql.tests.DistributedQueryRunner) TpchPlugin(io.prestosql.plugin.tpch.TpchPlugin)

Aggregations

TpchPlugin (io.prestosql.plugin.tpch.TpchPlugin)2 DistributedQueryRunner (io.prestosql.tests.DistributedQueryRunner)2 TestingPrestoClient (io.prestosql.tests.TestingPrestoClient)2 SchemaTableName (io.prestosql.spi.connector.SchemaTableName)1