use of com.facebook.presto.tests.DistributedQueryRunner in project presto by prestodb.
the class TestMySqlIntegrationSmokeTest 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", mysqlServer.getJdbcUrl());
try (QueryRunner queryRunner = new DistributedQueryRunner(getSession(), 3, properties)) {
queryRunner.installPlugin(new MySqlPlugin());
queryRunner.createCatalog("mysql", "mysql", 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 TestQueryRunnerUtil method createQueryRunner.
public static DistributedQueryRunner createQueryRunner(Map<String, String> extraProperties) throws Exception {
DistributedQueryRunner queryRunner = DistributedQueryRunner.builder(testSessionBuilder().build()).setExtraProperties(extraProperties).setNodeCount(2).build();
try {
queryRunner.installPlugin(new TpchPlugin());
queryRunner.createCatalog("tpch", "tpch");
return queryRunner;
} catch (Exception e) {
queryRunner.close();
throw e;
}
}
use of com.facebook.presto.tests.DistributedQueryRunner in project presto by prestodb.
the class MemoryQueryRunner method createQueryRunner.
public static DistributedQueryRunner createQueryRunner(Map<String, String> coordinatorProperties, Map<String, String> extraProperties) throws Exception {
Session session = testSessionBuilder().setCatalog(CATALOG).setSchema("default").build();
DistributedQueryRunner queryRunner = DistributedQueryRunner.builder(session).setNodeCount(4).setCoordinatorProperties(coordinatorProperties).setExtraProperties(extraProperties).build();
try {
queryRunner.installPlugin(new MemoryPlugin());
queryRunner.createCatalog(CATALOG, "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;
}
}
use of com.facebook.presto.tests.DistributedQueryRunner in project presto by prestodb.
the class MemoryQueryRunner method main.
public static void main(String[] args) throws Exception {
Logging.initialize();
DistributedQueryRunner queryRunner = createQueryRunner(ImmutableMap.of(), ImmutableMap.of("http-server.http.port", "8080"));
Thread.sleep(10);
Logger log = Logger.get(MemoryQueryRunner.class);
log.info("======== SERVER STARTED ========");
log.info("\n====\n%s\n====", queryRunner.getCoordinator().getBaseUrl());
}
use of com.facebook.presto.tests.DistributedQueryRunner in project presto by prestodb.
the class TpcdsQueryRunner method main.
public static void main(String[] args) throws Exception {
Logging.initialize();
DistributedQueryRunner queryRunner = createQueryRunner(ImmutableMap.of("http-server.http.port", "8080"));
Thread.sleep(10);
Logger log = Logger.get(TpcdsQueryRunner.class);
log.info("======== SERVER STARTED ========");
log.info("\n====\n%s\n====", queryRunner.getCoordinator().getBaseUrl());
}
Aggregations