use of org.apache.drill.test.QueryBuilder in project drill by apache.
the class TestParquetLimitPushDown method testMultipleFiles.
@Test
public void testMultipleFiles() throws Exception {
String query = "select * from dfs.`parquet/users` limit 1";
QueryBuilder.QuerySummary summary = queryBuilder().sql(query).run();
assertTrue(summary.succeeded());
assertEquals(1, summary.recordCount());
String plan = queryBuilder().sql(query).explainText();
assertThat(plan, containsString("numRowGroups=1"));
}
use of org.apache.drill.test.QueryBuilder in project drill by apache.
the class TestParquetLimitPushDown method testLimitZero.
@Test
public void testLimitZero() throws Exception {
String query = "select * from dfs.`parquet/users` limit 0";
QueryBuilder.QuerySummary summary = queryBuilder().sql(query).run();
assertTrue(summary.succeeded());
assertEquals(0, summary.recordCount());
String plan = queryBuilder().sql(query).explainText();
assertThat(plan, containsString("numRowGroups=1"));
}
use of org.apache.drill.test.QueryBuilder in project drill by apache.
the class TestParquetLimitPushDown method testMultipleRowGroups.
@Test
public void testMultipleRowGroups() throws Exception {
String query = "select * from dfs.`parquet/multirowgroup.parquet` limit 1";
QueryBuilder.QuerySummary summary = queryBuilder().sql(query).run();
assertTrue(summary.succeeded());
assertEquals(1, summary.recordCount());
String plan = queryBuilder().sql(query).explainText();
assertThat(plan, containsString("numRowGroups=1"));
}
use of org.apache.drill.test.QueryBuilder in project drill by apache.
the class TestSequenceFileReader method testLimitPushdown.
@Test
public void testLimitPushdown() throws Exception {
String sql = "select * from cp.`sequencefiles/simple.seq` limit 1 offset 1";
QueryBuilder builder = client.queryBuilder().sql(sql);
RowSet sets = builder.rowSet();
assertEquals(1, sets.rowCount());
sets.clear();
}
use of org.apache.drill.test.QueryBuilder in project drill by apache.
the class TestSequenceFileReader method testExplicitQuery.
@Test
public void testExplicitQuery() throws Exception {
String sql = "select convert_from(binary_key, 'UTF8') as binary_key from cp.`sequencefiles/simple.seq`";
QueryBuilder builder = client.queryBuilder().sql(sql);
RowSet sets = builder.rowSet();
TupleMetadata schema = new SchemaBuilder().addNullable(SequenceFileBatchReader.KEY_SCHEMA, MinorType.VARCHAR).build();
RowSet expected = new RowSetBuilder(client.allocator(), schema).addRow(byteWritableString("key0")).addRow(byteWritableString("key1")).build();
assertEquals(2, sets.rowCount());
new RowSetComparison(expected).verifyAndClearAll(sets);
}
Aggregations