use of org.apache.drill.test.QueryBuilder in project drill by apache.
the class TestPcapngRecordReader method testExplicitQueryWithCompressedFile.
@Test
public void testExplicitQueryWithCompressedFile() throws Exception {
QueryTestUtil.generateCompressedFile("pcapng/sniff.pcapng", "zip", "pcapng/sniff.pcapng.zip");
String sql = "select type, packet_length, `timestamp` from dfs.`pcapng/sniff.pcapng.zip` where type = 'ARP'";
QueryBuilder builder = client.queryBuilder().sql(sql);
RowSet sets = builder.rowSet();
TupleMetadata schema = new SchemaBuilder().addNullable("type", MinorType.VARCHAR).add("packet_length", MinorType.INT).add("timestamp", MinorType.TIMESTAMP).buildSchema();
RowSet expected = new RowSetBuilder(client.allocator(), schema).addRow("ARP", 90, Instant.ofEpochMilli(1518010669927L)).addRow("ARP", 90, Instant.ofEpochMilli(1518010671874L)).build();
assertEquals(2, sets.rowCount());
new RowSetComparison(expected).verifyAndClearAll(sets);
}
use of org.apache.drill.test.QueryBuilder in project drill by apache.
the class TestPcapngRecordReader method testGroupBy.
@Test
public void testGroupBy() throws Exception {
String sql = "select src_ip, count(1), sum(packet_length) from dfs.`pcapng/sniff.pcapng` group by src_ip";
QueryBuilder builder = client.queryBuilder().sql(sql);
RowSet sets = builder.rowSet();
assertEquals(47, sets.rowCount());
sets.clear();
}
use of org.apache.drill.test.QueryBuilder in project drill by apache.
the class TestPcapngRecordReader method testCaseInsensitiveQuery.
@Test
public void testCaseInsensitiveQuery() throws Exception {
String sql = "select `timestamp`, paCket_dAta, TyPe from dfs.`pcapng/sniff.pcapng`";
QueryBuilder builder = client.queryBuilder().sql(sql);
RowSet sets = builder.rowSet();
assertEquals(123, sets.rowCount());
sets.clear();
}
use of org.apache.drill.test.QueryBuilder in project drill by apache.
the class TestPcapngRecordReader method testStarQuery.
@Test
public void testStarQuery() throws Exception {
String sql = "select * from dfs.`pcapng/sniff.pcapng`";
QueryBuilder builder = client.queryBuilder().sql(sql);
RowSet sets = builder.rowSet();
assertEquals(123, sets.rowCount());
sets.clear();
}
use of org.apache.drill.test.QueryBuilder in project drill by apache.
the class TestPcapngRecordReader method testLimitPushdown.
@Test
public void testLimitPushdown() throws Exception {
String sql = "select * from dfs.`pcapng/sniff.pcapng` where type = 'UDP' limit 10 offset 65";
QueryBuilder builder = client.queryBuilder().sql(sql);
RowSet sets = builder.rowSet();
assertEquals(6, sets.rowCount());
sets.clear();
}
Aggregations