use of org.apache.drill.test.TestBuilder in project drill by apache.
the class AvroFormatTest method testMapSchemaComplex_withNullValues.
@Test
public void testMapSchemaComplex_withNullValues() throws Exception {
String file = dataGenerator.generateMapSchemaComplex_withNullValues().getFileName();
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");
List<Object> expectedList = new ArrayList<>();
for (int i = 0; i < AvroDataGenerator.ARRAY_SIZE; i++) {
expectedList.add((double) i);
}
List<Object> emptyList = listOf();
for (int i = 0; i < AvroDataGenerator.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 apache.
the class TestInfoSchema method showDatabases.
@Test
public void showDatabases() throws Exception {
List<String> expected = Arrays.asList("dfs.default", "dfs.root", "dfs.tmp", "cp.default", "sys", "information_schema");
TestBuilder t1 = testBuilder().sqlQuery("SHOW DATABASES").unOrdered().baselineColumns("SCHEMA_NAME");
expected.forEach(t1::baselineValues);
t1.go();
TestBuilder t2 = testBuilder().sqlQuery("SHOW SCHEMAS").unOrdered().baselineColumns("SCHEMA_NAME");
expected.forEach(t2::baselineValues);
t2.go();
}
use of org.apache.drill.test.TestBuilder in project drill by apache.
the class TestInfoSchemaOnHiveStorage method describeHelper.
private static void describeHelper(final String options, final String describeCmd) throws Exception {
final TestBuilder builder = testBuilder();
if (!Strings.isNullOrEmpty(options)) {
builder.optionSettingQueriesForTestQuery(options);
}
builder.sqlQuery(describeCmd).unOrdered().baselineColumns(baselineCols).baselineValues(expVal1).baselineValues(expVal2).go();
}
use of org.apache.drill.test.TestBuilder in project drill by axbaretto.
the class TestInfoSchemaOnHiveStorage method describeHelper.
private static void describeHelper(final String options, final String describeCmd) throws Exception {
final TestBuilder builder = testBuilder();
if (!Strings.isNullOrEmpty(options)) {
builder.optionSettingQueriesForTestQuery(options);
}
builder.sqlQuery(describeCmd).unOrdered().baselineColumns(baselineCols).baselineValues(expVal1).baselineValues(expVal2).go();
}
use of org.apache.drill.test.TestBuilder in project drill by axbaretto.
the class TestCorruptParquetDateCorrection method testReadOldMetadataCacheFile.
@Test
public void testReadOldMetadataCacheFile() throws Exception {
// for sanity, try reading all partitions without a filter
String query = format("select date_col from dfs.`%s`", PARTITIONED_1_2_FOLDER);
TestBuilder builder = testBuilder().sqlQuery(query).unOrdered().baselineColumns("date_col");
addDateBaselineValues(builder);
builder.go();
testPlanMatchingPatterns(query, new String[] { "usedMetadataFile=true" }, null);
}
Aggregations