use of org.apache.drill.test.TestBuilder in project drill by axbaretto.
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 axbaretto.
the class AvroFormatTest method testMapSchemaComplex_withNullValues.
@Test
public void testMapSchemaComplex_withNullValues() throws Exception {
final String file = generateMapSchemaComplex_withNullValues().getFileName();
final String sql = "select d_map['key1'] nested_key1, d_map['key2'] nested_key2 from dfs.`%s`";
TestBuilder testBuilder = testBuilder().sqlQuery(sql, file).unOrdered().baselineColumns("nested_key1", "nested_key2");
final List<Object> expectedList = Lists.newArrayList();
for (int i = 0; i < AvroTestUtil.ARRAY_SIZE; i++) {
expectedList.add((double) i);
}
final List<Object> emptyList = listOf();
for (int i = 0; i < AvroTestUtil.RECORD_COUNT; i += 2) {
testBuilder.baselineValues(expectedList, expectedList);
testBuilder.baselineValues(emptyList, emptyList);
}
testBuilder.go();
}
use of org.apache.drill.test.TestBuilder in project drill by axbaretto.
the class AvroFormatTest method testFiltersOnVarBinary.
@Test
public void testFiltersOnVarBinary() throws Exception {
final String file = generateSimplePrimitiveSchema_NoNullValues(5000).getFileName();
final String sql = "select f_bytes from dfs.`%s` where f_bytes = BINARY_STRING('\\x61\\x31')";
TestBuilder testBuilder = testBuilder().sqlQuery(sql, file).unOrdered().baselineColumns("f_bytes");
for (int i = 0; i < 500; i++) {
testBuilder.baselineValues(new byte[] { 'a', '1' });
}
testBuilder.go();
final String sql2 = "select f_bytes from dfs.`%s` where f_bytes IN (BINARY_STRING('\\x61\\x31'))";
testBuilder = testBuilder().sqlQuery(sql2, file).unOrdered().baselineColumns("f_bytes");
for (int i = 0; i < 500; i++) {
testBuilder.baselineValues(new byte[] { 'a', '1' });
}
testBuilder.go();
}
use of org.apache.drill.test.TestBuilder in project drill by axbaretto.
the class AvroFormatTest method testFlattenEmptyComplexArrayMustYieldNoResults.
// DRILL-4574
@Test
public void testFlattenEmptyComplexArrayMustYieldNoResults() throws Exception {
final String file = generateNestedArraySchema(AvroTestUtil.RECORD_COUNT, 0).getFilePath();
TestBuilder testBuilder = nestedArrayQueryTestBuilder(file);
testBuilder.expectsEmptyResultSet();
}
use of org.apache.drill.test.TestBuilder in project drill by axbaretto.
the class AvroFormatTest method testFlattenComplexArray.
// DRILL-4574
@Test
public void testFlattenComplexArray() throws Exception {
final String file = generateNestedArraySchema().getFileName();
TestBuilder testBuilder = nestedArrayQueryTestBuilder(file);
for (int i = 0; i < AvroTestUtil.RECORD_COUNT; i++) {
for (int j = 0; j < AvroTestUtil.ARRAY_SIZE; j++) {
testBuilder.baselineValues(i, j);
}
}
testBuilder.go();
}
Aggregations