use of com.facebook.presto.Session in project presto by prestodb.
the class AbstractTestQueries method assertDescribeOutputEmpty.
private void assertDescribeOutputEmpty(@Language("SQL") String sql) {
Session session = Session.builder(getSession()).addPreparedStatement("my_query", sql).build();
MaterializedResult actual = computeActual(session, "DESCRIBE OUTPUT my_query");
MaterializedResult expected = resultBuilder(session, VARCHAR, VARCHAR, VARCHAR, VARCHAR, VARCHAR, BIGINT, BOOLEAN).build();
assertEqualsIgnoreOrder(actual, expected);
}
use of com.facebook.presto.Session in project presto by prestodb.
the class AbstractTestQueries method testDescribeOutputOnAliasedColumnsAndExpressions.
@Test
public void testDescribeOutputOnAliasedColumnsAndExpressions() {
Session session = Session.builder(getSession()).addPreparedStatement("my_query", "select count(*) as this_is_aliased, 1 + 2 from nation").build();
MaterializedResult actual = computeActual(session, "DESCRIBE OUTPUT my_query");
MaterializedResult expected = resultBuilder(session, VARCHAR, VARCHAR, VARCHAR, VARCHAR, VARCHAR, BIGINT, BOOLEAN).row("this_is_aliased", "", "", "", "bigint", 8, true).row("_col1", "", "", "", "integer", 4, false).build();
assertEqualsIgnoreOrder(actual, expected);
}
use of com.facebook.presto.Session in project presto by prestodb.
the class AbstractTestQueries method testExecuteUsingWithSubqueryInJoin.
@Test
public void testExecuteUsingWithSubqueryInJoin() {
String query = "SELECT * " + "FROM " + " (VALUES ?,2,3) t(x) " + " JOIN " + " (VALUES 1,2,3) t2(y) " + " ON " + "(x in (VALUES 1,2,?)) = (y in (VALUES 1,2,3)) AND (x in (VALUES 1,?)) = (y in (VALUES 1,2))";
Session session = Session.builder(getSession()).addPreparedStatement("my_query", query).build();
assertQuery(session, "EXECUTE my_query USING 1, 3, 2", "VALUES (1,1), (1,2), (2,2), (2,1), (3,3)");
}
use of com.facebook.presto.Session in project presto by prestodb.
the class AbstractTestQueries method testExecuteUsing.
@Test
public void testExecuteUsing() {
String query = "SELECT a + 1, count(?) FROM (VALUES 1, 2, 3, 2) t1(a) JOIN (VALUES 1, 2, 3, 4) t2(b) ON b < ? WHERE a < ? GROUP BY a + 1 HAVING count(1) > ?";
Session session = Session.builder(getSession()).addPreparedStatement("my_query", query).build();
assertQuery(session, "EXECUTE my_query USING 1, 5, 4, 0", "VALUES (2, 4), (3, 8), (4, 4)");
}
use of com.facebook.presto.Session in project presto by prestodb.
the class AbstractTestQueries method testExecute.
@Test
public void testExecute() {
Session session = Session.builder(getSession()).addPreparedStatement("my_query", "SELECT 123, 'abc'").build();
assertQuery(session, "EXECUTE my_query", "SELECT 123, 'abc'");
}
Aggregations