Search in sources :

Example 1 with TpchPlugin

use of com.facebook.presto.tpch.TpchPlugin in project presto by prestodb.

the class MongoQueryRunner method createMongoQueryRunner.

public static MongoQueryRunner createMongoQueryRunner(Iterable<TpchTable<?>> tables) throws Exception {
    MongoQueryRunner queryRunner = null;
    try {
        queryRunner = new MongoQueryRunner(createSession(), 3);
        queryRunner.installPlugin(new TpchPlugin());
        queryRunner.createCatalog("tpch", "tpch");
        Map<String, String> properties = ImmutableMap.of("mongodb.seeds", queryRunner.getAddress().getHostString() + ":" + queryRunner.getAddress().getPort(), "mongodb.socket-keep-alive", "true");
        queryRunner.installPlugin(new MongoPlugin());
        queryRunner.createCatalog("mongodb", "mongodb", properties);
        copyTpchTables(queryRunner, "tpch", TINY_SCHEMA_NAME, createSession(), tables);
        return queryRunner;
    } catch (Throwable e) {
        closeAllSuppress(e, queryRunner);
        throw e;
    }
}
Also used : TpchPlugin(com.facebook.presto.tpch.TpchPlugin)

Example 2 with TpchPlugin

use of com.facebook.presto.tpch.TpchPlugin in project presto by prestodb.

the class MemoryQueryRunner method createQueryRunner.

public static DistributedQueryRunner createQueryRunner(Map<String, String> extraProperties) throws Exception {
    Session session = testSessionBuilder().setCatalog("memory").setSchema("default").build();
    DistributedQueryRunner queryRunner = new DistributedQueryRunner(session, 4, extraProperties);
    try {
        queryRunner.installPlugin(new MemoryPlugin());
        queryRunner.createCatalog("memory", "memory", ImmutableMap.of());
        queryRunner.installPlugin(new TpchPlugin());
        queryRunner.createCatalog("tpch", "tpch", ImmutableMap.of());
        copyTpchTables(queryRunner, "tpch", TINY_SCHEMA_NAME, session, TpchTable.getTables());
        return queryRunner;
    } catch (Exception e) {
        closeAllSuppress(e, queryRunner);
        throw e;
    }
}
Also used : DistributedQueryRunner(com.facebook.presto.tests.DistributedQueryRunner) TpchPlugin(com.facebook.presto.tpch.TpchPlugin) Session(com.facebook.presto.Session)

Example 3 with TpchPlugin

use of com.facebook.presto.tpch.TpchPlugin in project presto by prestodb.

the class PostgreSqlQueryRunner method createPostgreSqlQueryRunner.

public static QueryRunner createPostgreSqlQueryRunner(TestingPostgreSqlServer server, Iterable<TpchTable<?>> tables) throws Exception {
    DistributedQueryRunner queryRunner = null;
    try {
        queryRunner = new DistributedQueryRunner(createSession(), 3);
        queryRunner.installPlugin(new TpchPlugin());
        queryRunner.createCatalog("tpch", "tpch");
        Map<String, String> properties = ImmutableMap.<String, String>builder().put("connection-url", server.getJdbcUrl()).put("allow-drop-table", "true").build();
        createSchema(server.getJdbcUrl(), "tpch");
        queryRunner.installPlugin(new PostgreSqlPlugin());
        queryRunner.createCatalog("postgresql", "postgresql", properties);
        copyTpchTables(queryRunner, "tpch", TINY_SCHEMA_NAME, createSession(), tables);
        return queryRunner;
    } catch (Throwable e) {
        closeAllSuppress(e, queryRunner, server);
        throw e;
    }
}
Also used : DistributedQueryRunner(com.facebook.presto.tests.DistributedQueryRunner) TpchPlugin(com.facebook.presto.tpch.TpchPlugin)

Example 4 with TpchPlugin

use of com.facebook.presto.tpch.TpchPlugin in project presto by prestodb.

the class TestRaptorIntegrationSmokeTestMySql method createRaptorMySqlQueryRunner.

private static DistributedQueryRunner createRaptorMySqlQueryRunner(TestingMySqlServer server) throws Exception {
    DistributedQueryRunner queryRunner = new DistributedQueryRunner(createSession("tpch"), 2);
    queryRunner.installPlugin(new TpchPlugin());
    queryRunner.createCatalog("tpch", "tpch");
    queryRunner.installPlugin(new RaptorPlugin());
    File baseDir = queryRunner.getCoordinator().getBaseDataDir().toFile();
    Map<String, String> raptorProperties = ImmutableMap.<String, String>builder().put("metadata.db.type", "mysql").put("metadata.db.url", jdbcUrl(server)).put("storage.data-directory", new File(baseDir, "data").getAbsolutePath()).put("storage.max-shard-rows", "2000").put("backup.provider", "file").put("backup.directory", new File(baseDir, "backup").getAbsolutePath()).build();
    queryRunner.createCatalog("raptor", "raptor", raptorProperties);
    copyTables(queryRunner, "tpch", createSession(), false);
    return queryRunner;
}
Also used : DistributedQueryRunner(com.facebook.presto.tests.DistributedQueryRunner) TpchPlugin(com.facebook.presto.tpch.TpchPlugin) File(java.io.File)

Example 5 with TpchPlugin

use of com.facebook.presto.tpch.TpchPlugin in project presto by prestodb.

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(com.facebook.presto.tests.TestingPrestoClient) DistributedQueryRunner(com.facebook.presto.tests.DistributedQueryRunner) TpchPlugin(com.facebook.presto.tpch.TpchPlugin) SchemaTableName(com.facebook.presto.spi.SchemaTableName)

Aggregations

TpchPlugin (com.facebook.presto.tpch.TpchPlugin)20 DistributedQueryRunner (com.facebook.presto.tests.DistributedQueryRunner)17 Session (com.facebook.presto.Session)3 SqlParserOptions (com.facebook.presto.sql.parser.SqlParserOptions)3 File (java.io.File)3 BeforeClass (org.testng.annotations.BeforeClass)3 SchemaTableName (com.facebook.presto.spi.SchemaTableName)2 TestingPrestoClient (com.facebook.presto.tests.TestingPrestoClient)2 LexicoderRowSerializer (com.facebook.presto.accumulo.serializers.LexicoderRowSerializer)1 TestingEventListenerPlugin (com.facebook.presto.execution.TestEventListenerPlugin.TestingEventListenerPlugin)1 NoHdfsAuthentication (com.facebook.presto.hive.authentication.NoHdfsAuthentication)1 FileHiveMetastore (com.facebook.presto.hive.metastore.file.FileHiveMetastore)1 BlackHolePlugin (com.facebook.presto.plugin.blackhole.BlackHolePlugin)1 TestingPrestoServer (com.facebook.presto.server.testing.TestingPrestoServer)1 Plugin (com.facebook.presto.spi.Plugin)1 ImmutableMap (com.google.common.collect.ImmutableMap)1 TpchTable (io.airlift.tpch.TpchTable)1 ExecutionException (java.util.concurrent.ExecutionException)1 Text (org.apache.hadoop.io.Text)1