use of org.apache.drill.test.TestBuilder in project drill by apache.
the class AvroFormatTest method testMapSchema.
@Test
public void testMapSchema() throws Exception {
String sql = "select map_field from dfs.`%s`";
TestBuilder testBuilder = testBuilder().sqlQuery(sql, mapTableName).unOrdered().baselineColumns("map_field");
for (long i = 0; i < AvroDataGenerator.RECORD_COUNT; i++) {
testBuilder.baselineValues(mapOfObject("key1", i, "key2", i + 1));
}
testBuilder.go();
}
use of org.apache.drill.test.TestBuilder in project drill by apache.
the class AvroFormatTest method testDecimal.
@Test
public void testDecimal() throws Exception {
int numRows = 5;
String fileName = dataGenerator.generateDecimalData(numRows);
TestBuilder testBuilder = testBuilder().sqlQuery("select * from dfs.`%s`", fileName).unOrdered().baselineColumns("col_dec_pos_bytes", "col_dec_neg_bytes", "col_dec_pos_fixed", "col_dec_neg_fixed");
for (int i = 0; i < numRows; i++) {
testBuilder.baselineValues(new BigDecimal(BigInteger.valueOf(100 + i), 2), new BigDecimal(BigInteger.valueOf(-200 + i), 2), new BigDecimal(BigInteger.valueOf(300 + i), 2), new BigDecimal(BigInteger.valueOf(-400 + i), 2));
}
testBuilder.go();
}
use of org.apache.drill.test.TestBuilder in project drill by apache.
the class TestCsvHeader method testEmptyFinalColumn.
@Test
public void testEmptyFinalColumn() throws Exception {
File table_dir = dirTestWatcher.makeTestTmpSubDir(Paths.get("emptyFinalColumn"));
BufferedOutputStream os = new BufferedOutputStream(new FileOutputStream(new File(table_dir, "a.csvh")));
os.write("field1,field2\n".getBytes());
for (int i = 0; i < 10000; i++) {
os.write("a,\n".getBytes());
}
os.flush();
os.close();
String query = "select * from dfs.tmp.emptyFinalColumn";
TestBuilder builder = testBuilder().sqlQuery(query).ordered().baselineColumns("field1", "field2");
for (int i = 0; i < 10000; i++) {
builder.baselineValues("a", "");
}
builder.go();
}
use of org.apache.drill.test.TestBuilder in project drill by apache.
the class TestSelectWithOption method testWithResult.
private void testWithResult(String query, Object... expectedResult) throws Exception {
TestBuilder builder = testBuilder().sqlQuery(query).ordered().baselineColumns("columns");
for (Object o : expectedResult) {
builder = builder.baselineValues(o);
}
builder.build().run();
}
use of org.apache.drill.test.TestBuilder in project drill by apache.
the class TopNBatchTest method sortOneKeyAscending.
/**
* End to end test of the TopN operator.
* @throws Throwable
*/
@Test
public void sortOneKeyAscending() throws Throwable {
ClusterFixtureBuilder builder = ClusterFixture.builder(dirTestWatcher);
try (ClusterFixture cluster = builder.build();
ClientFixture client = cluster.clientFixture()) {
TestBuilder testBuilder = new TestBuilder(new ClusterFixture.FixtureTestServices(client));
testBuilder.ordered().physicalPlanFromFile("topN/one_key_sort.json").baselineColumns("blue").go();
}
}
Aggregations