use of org.apache.drill.test.TestBuilder in project drill by apache.
the class AvroFormatTest method testMapSchemaArrayValue.
@Test
public void testMapSchemaArrayValue() throws Exception {
String sql = "select map_array_value from dfs.`%s`";
TestBuilder testBuilder = testBuilder().sqlQuery(sql, mapTableName).unOrdered().baselineColumns("map_array_value");
for (int i = 0; i < AvroDataGenerator.RECORD_COUNT; i++) {
List<Object> doubleArray = listOf();
for (double j = 0; j < AvroDataGenerator.ARRAY_SIZE; j++) {
doubleArray.add((double) (i + 1) * j);
}
testBuilder.baselineValues(mapOfObject("key1", doubleArray, "key2", doubleArray));
}
testBuilder.go();
}
use of org.apache.drill.test.TestBuilder in project drill by apache.
the class AvroFormatTest method testArrayMapSchemaGetElementByIndex.
@Test
public void testArrayMapSchemaGetElementByIndex() throws Exception {
int elementIndex = 1;
String sql = "select map_array[%d] element from dfs.`%s`";
TestBuilder testBuilder = testBuilder().sqlQuery(sql, elementIndex, mapTableName).unOrdered().baselineColumns("element");
for (int i = 0; i < AvroDataGenerator.RECORD_COUNT; i++) {
testBuilder.baselineValues(mapOfObject("key1", (i + 1) * (elementIndex + 50), "key2", (i + 1) * (elementIndex + 100)));
}
testBuilder.go();
}
use of org.apache.drill.test.TestBuilder in project drill by apache.
the class AvroFormatTest method testMapSchemaArrayValueGetByKey.
@Test
public void testMapSchemaArrayValueGetByKey() throws Exception {
String sql = "select map_array_value['key1'] element from dfs.`%s`";
TestBuilder testBuilder = testBuilder().sqlQuery(sql, dataGenerator.generateMapSchema().getFileName()).unOrdered().baselineColumns("element");
for (int i = 0; i < AvroDataGenerator.RECORD_COUNT; i++) {
List<Object> doubleArray = listOf();
for (double j = 0; j < AvroDataGenerator.ARRAY_SIZE; j++) {
doubleArray.add((double) (i + 1) * j);
}
testBuilder.baselineValues(doubleArray);
}
testBuilder.go();
}
use of org.apache.drill.test.TestBuilder in project drill by apache.
the class AvroFormatTest method testFlattenEmptyComplexArrayMustYieldNoResults.
// DRILL-4574
@Test
public void testFlattenEmptyComplexArrayMustYieldNoResults() throws Exception {
String file = dataGenerator.generateNestedArraySchema(AvroDataGenerator.RECORD_COUNT, 0).getFilePath();
TestBuilder testBuilder = nestedArrayQueryTestBuilder(file);
testBuilder.expectsEmptyResultSet();
}
use of org.apache.drill.test.TestBuilder in project drill by apache.
the class AvroFormatTest method testFlattenComplexArray.
// DRILL-4574
@Test
public void testFlattenComplexArray() throws Exception {
String file = dataGenerator.generateNestedArraySchema().getFileName();
TestBuilder testBuilder = nestedArrayQueryTestBuilder(file);
for (int i = 0; i < AvroDataGenerator.RECORD_COUNT; i++) {
for (int j = 0; j < AvroDataGenerator.ARRAY_SIZE; j++) {
testBuilder.baselineValues(i, j);
}
}
testBuilder.go();
}
Aggregations