use of io.prestodb.tempto.query.QueryResult in project presto by prestodb.
the class CreateTableAsSelect method testCreateTableAsSelect.
@Requires(ImmutableNationTable.class)
@Test(groups = { JDBC, MYSQL })
public void testCreateTableAsSelect() {
QueryResult queryResult = query(format("CREATE TABLE mysql.%s AS SELECT * FROM nation", TABLE_NAME));
assertThat(queryResult).containsOnly(row(25));
}
use of io.prestodb.tempto.query.QueryResult in project presto by prestodb.
the class TestInsert method testInsertMin.
@Test(groups = { SQL_SERVER, PROFILE_SPECIFIC_TESTS })
public void testInsertMin() {
String sql = format("INSERT INTO %s.%s values (BIGINT '%s', SMALLINT '%s', INTEGER '%s', DOUBLE '%s', " + "CHAR 'a ', 'aa', DOUBLE '%s', DATE '%s')", SQLSERVER, INSERT_TABLE_NAME, Long.valueOf("-9223372036854775807"), Short.MIN_VALUE, Integer.MIN_VALUE, Double.MIN_VALUE, Double.MIN_VALUE, Date.valueOf("1970-01-01"));
// Min value for BIGINT would be updated to "-9223372036854775808" post https://github.com/prestodb/presto/issues/4571
onPresto().executeQuery(sql);
sql = format("SELECT * FROM %s.%s", MASTER, INSERT_TABLE_NAME);
QueryResult queryResult = onSqlServer().executeQuery(sql);
assertThat(queryResult).contains(row(Long.valueOf("-9223372036854775807"), Short.MIN_VALUE, Integer.MIN_VALUE, Double.MIN_VALUE, "a ", "aa", Double.MIN_VALUE, Date.valueOf("1970-01-01")));
}
use of io.prestodb.tempto.query.QueryResult in project presto by prestodb.
the class TestInsert method testInsertMax.
@Test(groups = { SQL_SERVER, PROFILE_SPECIFIC_TESTS })
public void testInsertMax() {
String sql = format("INSERT INTO %s.%s values (BIGINT '%s', SMALLINT '%s', INTEGER '%s', DOUBLE '%s', " + "CHAR 'aaaa', 'aaaaaa', DOUBLE '%s', DATE '%s' )", SQLSERVER, INSERT_TABLE_NAME, Long.MAX_VALUE, Short.MAX_VALUE, Integer.MAX_VALUE, Double.MAX_VALUE, Double.valueOf("12345678912.3456756"), Date.valueOf("9999-12-31"));
onPresto().executeQuery(sql);
sql = format("SELECT * FROM %s.%s", MASTER, INSERT_TABLE_NAME);
QueryResult queryResult = onSqlServer().executeQuery(sql);
assertThat(queryResult).contains(row(Long.MAX_VALUE, Short.MAX_VALUE, Integer.MAX_VALUE, Double.MAX_VALUE, "aaaa", "aaaaaa", Double.valueOf("12345678912.3456756"), Date.valueOf("9999-12-31")));
}
use of io.prestodb.tempto.query.QueryResult in project presto by prestodb.
the class TestSelect method testNationSelfInnerJoin.
@Test(groups = { SQL_SERVER, PROFILE_SPECIFIC_TESTS })
public void testNationSelfInnerJoin() {
String sql = format("SELECT n1.n_name, n2.n_regionkey FROM %s n1 JOIN " + "%s n2 ON n1.n_nationkey = n2.n_regionkey " + "WHERE n1.n_nationkey=3", NATION_TABLE_NAME, NATION_TABLE_NAME);
QueryResult queryResult = onPresto().executeQuery(sql);
assertThat(queryResult).containsOnly(row("CANADA", 3), row("CANADA", 3), row("CANADA", 3), row("CANADA", 3), row("CANADA", 3));
}
use of io.prestodb.tempto.query.QueryResult in project presto by prestodb.
the class TestSelect method testCreateTableAsSelect.
@Test(groups = { SQL_SERVER, PROFILE_SPECIFIC_TESTS })
public void testCreateTableAsSelect() {
String sql = format("CREATE TABLE %s AS SELECT * FROM %s", CREATE_TABLE_AS_SELECT, NATION_TABLE_NAME);
onPresto().executeQuery(sql);
sql = format("SELECT n_nationkey, n_name, n_regionkey, n_comment FROM %s.%s.%s", "master", KEY_SPACE, CTAS_TABLE_NAME);
QueryResult queryResult = onSqlServer().executeQuery(sql);
assertThat(queryResult).matches(PRESTO_NATION_RESULT);
}
Aggregations