use of com.facebook.presto.testing.MaterializedResult in project presto by prestodb.
the class AbstractTestQueries method testDescribeInput.
@Test
public void testDescribeInput() {
Session session = Session.builder(getSession()).addPreparedStatement("my_query", "select ? from nation where nationkey = ? and name < ?").build();
MaterializedResult actual = computeActual(session, "DESCRIBE INPUT my_query");
MaterializedResult expected = resultBuilder(session, BIGINT, VARCHAR).row(0, "unknown").row(1, "bigint").row(2, "varchar").build();
assertEqualsIgnoreOrder(actual, expected);
}
use of com.facebook.presto.testing.MaterializedResult in project presto by prestodb.
the class AbstractTestQueries method testTopNUnpartitionedWindowWithEqualityFilter.
@Test
public void testTopNUnpartitionedWindowWithEqualityFilter() {
MaterializedResult actual = computeActual("" + "SELECT * FROM (\n" + " SELECT row_number() OVER (ORDER BY orderkey) rn, orderkey, orderstatus\n" + " FROM orders\n" + ") WHERE rn = 2");
MaterializedResult expected = resultBuilder(getSession(), BIGINT, BIGINT, VARCHAR).row(2L, 2L, "O").build();
assertEqualsIgnoreOrder(actual.getMaterializedRows(), expected.getMaterializedRows());
}
use of com.facebook.presto.testing.MaterializedResult in project presto by prestodb.
the class AbstractTestQueries method testDescribeOutput.
@Test
public void testDescribeOutput() {
Session session = Session.builder(getSession()).addPreparedStatement("my_query", "SELECT * FROM nation").build();
MaterializedResult actual = computeActual(session, "DESCRIBE OUTPUT my_query");
MaterializedResult expected = resultBuilder(session, VARCHAR, VARCHAR, VARCHAR, VARCHAR, VARCHAR, BIGINT, BOOLEAN).row("nationkey", session.getCatalog().get(), session.getSchema().get(), "nation", "bigint", 8, false).row("name", session.getCatalog().get(), session.getSchema().get(), "nation", "varchar(25)", 0, false).row("regionkey", session.getCatalog().get(), session.getSchema().get(), "nation", "bigint", 8, false).row("comment", session.getCatalog().get(), session.getSchema().get(), "nation", "varchar(152)", 0, false).build();
assertEqualsIgnoreOrder(actual, expected);
}
use of com.facebook.presto.testing.MaterializedResult in project presto by prestodb.
the class AbstractTestQueries method testExplainOfExplainAnalyze.
@Test
public void testExplainOfExplainAnalyze() {
String query = "EXPLAIN ANALYZE SELECT * FROM orders";
MaterializedResult result = computeActual("EXPLAIN " + query);
assertEquals(getOnlyElement(result.getOnlyColumnAsSet()), getExplainPlan(query, LOGICAL));
}
use of com.facebook.presto.testing.MaterializedResult in project presto by prestodb.
the class AbstractTestQueries method testApproxSetWithNulls.
@Test
public void testApproxSetWithNulls() {
MaterializedResult actual = computeActual("SELECT cardinality(approx_set(IF(orderstatus = 'O', custkey))) FROM orders");
MaterializedResult expected = resultBuilder(getSession(), actual.getTypes()).row(1001L).build();
assertEquals(actual.getMaterializedRows(), expected.getMaterializedRows());
}
Aggregations