use of io.trino.plugin.tpch.TpchPlugin in project trino by trinodb.
the class ClickHouseQueryRunner method createClickHouseQueryRunner.
public static DistributedQueryRunner createClickHouseQueryRunner(TestingClickHouseServer server, Map<String, String> extraProperties, Map<String, String> connectorProperties, Iterable<TpchTable<?>> tables) throws Exception {
DistributedQueryRunner queryRunner = null;
try {
queryRunner = DistributedQueryRunner.builder(createSession()).setExtraProperties(extraProperties).build();
queryRunner.installPlugin(new TpchPlugin());
queryRunner.createCatalog("tpch", "tpch");
connectorProperties = new HashMap<>(ImmutableMap.copyOf(connectorProperties));
connectorProperties.putIfAbsent("connection-url", server.getJdbcUrl());
queryRunner.installPlugin(new ClickHousePlugin());
queryRunner.createCatalog("clickhouse", "clickhouse", connectorProperties);
queryRunner.execute("CREATE SCHEMA " + TPCH_SCHEMA);
copyTpchTables(queryRunner, "tpch", TINY_SCHEMA_NAME, createSession(), tables);
return queryRunner;
} catch (Throwable e) {
closeAllSuppress(e, queryRunner);
throw e;
}
}
use of io.trino.plugin.tpch.TpchPlugin in project trino by trinodb.
the class MySqlQueryRunner method createMySqlQueryRunner.
public static DistributedQueryRunner createMySqlQueryRunner(TestingMySqlServer server, Map<String, String> extraProperties, Map<String, String> connectorProperties, Iterable<TpchTable<?>> tables) throws Exception {
DistributedQueryRunner queryRunner = DistributedQueryRunner.builder(createSession()).setExtraProperties(extraProperties).build();
try {
queryRunner.installPlugin(new TpchPlugin());
queryRunner.createCatalog("tpch", "tpch");
connectorProperties = new HashMap<>(ImmutableMap.copyOf(connectorProperties));
connectorProperties.putIfAbsent("connection-url", server.getJdbcUrl());
connectorProperties.putIfAbsent("connection-user", server.getUsername());
connectorProperties.putIfAbsent("connection-password", server.getPassword());
queryRunner.installPlugin(new MySqlPlugin());
queryRunner.createCatalog("mysql", "mysql", connectorProperties);
copyTpchTables(queryRunner, "tpch", TINY_SCHEMA_NAME, createSession(), tables);
return queryRunner;
} catch (Throwable e) {
closeAllSuppress(e, queryRunner);
throw e;
}
}
use of io.trino.plugin.tpch.TpchPlugin in project trino by trinodb.
the class PhoenixQueryRunner method createPhoenixQueryRunner.
public static DistributedQueryRunner createPhoenixQueryRunner(TestingPhoenixServer server, Map<String, String> extraProperties, List<TpchTable<?>> tables) throws Exception {
DistributedQueryRunner queryRunner = DistributedQueryRunner.builder(createSession()).setExtraProperties(extraProperties).build();
queryRunner.installPlugin(new TpchPlugin());
queryRunner.createCatalog("tpch", "tpch");
Map<String, String> properties = ImmutableMap.<String, String>builder().put("phoenix.connection-url", server.getJdbcUrl()).put("case-insensitive-name-matching", "true").buildOrThrow();
queryRunner.installPlugin(new PhoenixPlugin());
queryRunner.createCatalog("phoenix", "phoenix5", properties);
if (!server.isTpchLoaded()) {
createSchema(server, TPCH_SCHEMA);
copyTpchTables(queryRunner, "tpch", TINY_SCHEMA_NAME, createSession(), tables);
server.setTpchLoaded();
} else {
server.waitTpchLoaded();
}
return queryRunner;
}
use of io.trino.plugin.tpch.TpchPlugin in project trino by trinodb.
the class RaptorQueryRunner method createRaptorQueryRunner.
public static DistributedQueryRunner createRaptorQueryRunner(Map<String, String> extraProperties, List<TpchTable<?>> tablesToLoad, boolean bucketed, Map<String, String> extraRaptorProperties) throws Exception {
DistributedQueryRunner queryRunner = DistributedQueryRunner.builder(createSession("tpch")).setExtraProperties(extraProperties).build();
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().putAll(extraRaptorProperties).put("metadata.db.type", "h2").put("metadata.db.connections.max", "100").put("metadata.db.filename", new File(baseDir, "db").getAbsolutePath()).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()).buildOrThrow();
queryRunner.createCatalog("raptor", "raptor-legacy", raptorProperties);
copyTables(queryRunner, "tpch", createSession(), bucketed, tablesToLoad);
return queryRunner;
}
use of io.trino.plugin.tpch.TpchPlugin in project trino by trinodb.
the class SqlServerQueryRunner method createSqlServerQueryRunner.
public static QueryRunner createSqlServerQueryRunner(TestingSqlServer testingSqlServer, Map<String, String> extraProperties, Map<String, String> connectorProperties, Iterable<TpchTable<?>> tables) throws Exception {
DistributedQueryRunner queryRunner = DistributedQueryRunner.builder(createSession(testingSqlServer.getUsername())).setExtraProperties(extraProperties).build();
try {
queryRunner.installPlugin(new TpchPlugin());
queryRunner.createCatalog("tpch", "tpch");
connectorProperties = new HashMap<>(ImmutableMap.copyOf(connectorProperties));
connectorProperties.putIfAbsent("connection-url", testingSqlServer.getJdbcUrl());
connectorProperties.putIfAbsent("connection-user", testingSqlServer.getUsername());
connectorProperties.putIfAbsent("connection-password", testingSqlServer.getPassword());
queryRunner.installPlugin(new SqlServerPlugin());
queryRunner.createCatalog(CATALOG, "sqlserver", connectorProperties);
copyTpchTables(queryRunner, "tpch", TINY_SCHEMA_NAME, createSession(testingSqlServer.getUsername()), tables);
return queryRunner;
} catch (Throwable e) {
closeAllSuppress(e, queryRunner);
throw e;
}
}
Aggregations