use of com.facebook.presto.tests.DistributedQueryRunner in project presto by prestodb.
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 com.facebook.presto.tests.DistributedQueryRunner in project presto by prestodb.
the class TpcdsQueryRunner method createQueryRunner.
public static DistributedQueryRunner createQueryRunner(Map<String, String> extraProperties, Map<String, String> coordinatorProperties) throws Exception {
Session session = testSessionBuilder().setSource("test").setCatalog("tpcds").setSchema("sf1").build();
DistributedQueryRunner queryRunner = DistributedQueryRunner.builder(session).setNodeCount(4).setExtraProperties(extraProperties).setCoordinatorProperties(coordinatorProperties).build();
try {
queryRunner.installPlugin(new TpcdsPlugin());
queryRunner.createCatalog("tpcds", "tpcds");
return queryRunner;
} catch (Exception e) {
queryRunner.close();
throw e;
}
}
use of com.facebook.presto.tests.DistributedQueryRunner in project presto by prestodb.
the class TestPostgreSqlIntegrationSmokeTest method testCharTrailingSpace.
@Test
public void testCharTrailingSpace() throws Exception {
execute("CREATE TABLE tpch.char_trailing_space (x char(10))");
assertUpdate("INSERT INTO char_trailing_space VALUES ('test')", 1);
assertQuery("SELECT * FROM char_trailing_space WHERE x = char 'test'", "VALUES 'test'");
assertQuery("SELECT * FROM char_trailing_space WHERE x = char 'test '", "VALUES 'test'");
assertQuery("SELECT * FROM char_trailing_space WHERE x = char 'test '", "VALUES 'test'");
assertEquals(getQueryRunner().execute("SELECT * FROM char_trailing_space WHERE x = char ' test'").getRowCount(), 0);
Map<String, String> properties = ImmutableMap.of("deprecated.legacy-char-to-varchar-coercion", "true");
Map<String, String> connectorProperties = ImmutableMap.of("connection-url", postgreSqlServer.getJdbcUrl());
try (QueryRunner queryRunner = new DistributedQueryRunner(getSession(), 3, properties)) {
queryRunner.installPlugin(new PostgreSqlPlugin());
queryRunner.createCatalog("postgresql", "postgresql", connectorProperties);
assertEquals(queryRunner.execute("SELECT * FROM char_trailing_space WHERE x = char 'test'").getRowCount(), 0);
assertEquals(queryRunner.execute("SELECT * FROM char_trailing_space WHERE x = char 'test '").getRowCount(), 0);
assertEquals(queryRunner.execute("SELECT * FROM char_trailing_space WHERE x = char 'test '").getRowCount(), 0);
MaterializedResult result = queryRunner.execute("SELECT * FROM char_trailing_space WHERE x = char 'test '");
assertEquals(result.getRowCount(), 1);
assertEquals(result.getMaterializedRows().get(0).getField(0), "test ");
}
assertUpdate("DROP TABLE char_trailing_space");
}
use of com.facebook.presto.tests.DistributedQueryRunner in project presto by prestodb.
the class RedisQueryRunner method createRedisQueryRunner.
public static DistributedQueryRunner createRedisQueryRunner(EmbeddedRedis embeddedRedis, String dataFormat, Iterable<TpchTable<?>> tables) throws Exception {
DistributedQueryRunner queryRunner = null;
try {
queryRunner = new DistributedQueryRunner(createSession(), 2);
queryRunner.installPlugin(new TpchPlugin());
queryRunner.createCatalog("tpch", "tpch");
embeddedRedis.start();
Map<SchemaTableName, RedisTableDescription> tableDescriptions = createTpchTableDescriptions(queryRunner.getCoordinator().getMetadata(), tables, dataFormat);
installRedisPlugin(embeddedRedis, queryRunner, tableDescriptions);
TestingPrestoClient prestoClient = queryRunner.getRandomClient();
log.info("Loading data...");
long startTime = System.nanoTime();
for (TpchTable<?> table : tables) {
loadTpchTable(embeddedRedis, prestoClient, table, dataFormat);
}
log.info("Loading complete in %s", nanosSince(startTime).toString(SECONDS));
embeddedRedis.destroyJedisPool();
return queryRunner;
} catch (Throwable e) {
closeAllSuppress(e, queryRunner, embeddedRedis);
throw e;
}
}
use of com.facebook.presto.tests.DistributedQueryRunner in project presto by prestodb.
the class TestRaptorIntegrationSmokeTestMySql method createRaptorMySqlQueryRunner.
private static DistributedQueryRunner createRaptorMySqlQueryRunner(String mysqlUrl) 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", mysqlUrl).put("storage.data-directory", new File(baseDir, "data").toURI().toString()).put("storage.max-shard-rows", "2000").put("backup.provider", "file").put("raptor.startup-grace-period", "10s").put("backup.directory", new File(baseDir, "backup").getAbsolutePath()).build();
queryRunner.createCatalog("raptor", "raptor", raptorProperties);
copyTables(queryRunner, "tpch", createSession(), false);
return queryRunner;
}
Aggregations