use of com.facebook.presto.common.type.ArrayType in project presto by prestodb.
the class AbstractTestParquetReader method testSingleLevelArrayOfStructOfStructOfSingleElement.
@Test
public void testSingleLevelArrayOfStructOfStructOfSingleElement() throws Exception {
Iterable<List> structs = createTestStructs(transform(intsBetween(0, 31_234), Object::toString));
Iterable<List> structsOfStructs = createTestStructs(structs);
Iterable<List<List>> values = createTestArrays(structsOfStructs);
List<String> structFieldNames = singletonList("test");
List<String> structsOfStructsFieldNames = singletonList("test");
Type structType = RowType.from(singletonList(field("test", VARCHAR)));
Type structsOfStructsType = RowType.from(singletonList(field("test", structType)));
ObjectInspector structObjectInspector = getStandardStructObjectInspector(structFieldNames, singletonList(javaStringObjectInspector));
tester.testRoundTrip(getStandardListObjectInspector(getStandardStructObjectInspector(structsOfStructsFieldNames, singletonList(structObjectInspector))), values, values, new ArrayType(structsOfStructsType));
tester.testSingleLevelArraySchemaRoundTrip(getStandardListObjectInspector(getStandardStructObjectInspector(structsOfStructsFieldNames, singletonList(structObjectInspector))), values, values, new ArrayType(structsOfStructsType));
}
use of com.facebook.presto.common.type.ArrayType in project presto by prestodb.
the class AbstractTestParquetReader method testArrayOfMaps.
@Test
public void testArrayOfMaps() throws Exception {
Iterable<Map<String, Long>> maps = createNullableTestMaps(transform(intsBetween(0, 10), Object::toString), longsBetween(0, 10));
List<List<Map<String, Long>>> values = createTestArrays(maps);
tester.testRoundTrip(getStandardListObjectInspector(getStandardMapObjectInspector(javaStringObjectInspector, javaLongObjectInspector)), values, values, new ArrayType(mapType(VARCHAR, BIGINT)));
}
use of com.facebook.presto.common.type.ArrayType in project presto by prestodb.
the class AbstractTestParquetReader method testOldAvroArray.
@Test
public void testOldAvroArray() throws Exception {
MessageType parquetMrAvroSchema = parseMessageType("message avro_schema_old {" + " optional group my_list (LIST){" + " repeated int32 array;" + " }" + "} ");
Iterable<List<Integer>> nonNullArrayElements = createTestArrays(intsBetween(0, 31_234));
tester.testSingleLevelArrayRoundTrip(getStandardListObjectInspector(javaIntObjectInspector), nonNullArrayElements, nonNullArrayElements, "my_list", new ArrayType(INTEGER), Optional.of(parquetMrAvroSchema));
}
use of com.facebook.presto.common.type.ArrayType in project presto by prestodb.
the class AbstractTestParquetReader method testSingleLevelArrayOfStructOfSingleElement.
@Test
public void testSingleLevelArrayOfStructOfSingleElement() throws Exception {
Iterable<List> structs = createTestStructs(transform(intsBetween(0, 31_234), Object::toString));
Iterable<List<List>> values = createTestArrays(structs);
List<String> structFieldNames = singletonList("test");
Type structType = RowType.from(singletonList(field("test", VARCHAR)));
tester.testRoundTrip(getStandardListObjectInspector(getStandardStructObjectInspector(structFieldNames, singletonList(javaStringObjectInspector))), values, values, new ArrayType(structType));
tester.testSingleLevelArraySchemaRoundTrip(getStandardListObjectInspector(getStandardStructObjectInspector(structFieldNames, singletonList(javaStringObjectInspector))), values, values, new ArrayType(structType));
}
use of com.facebook.presto.common.type.ArrayType in project presto by prestodb.
the class AbstractTestParquetReader method testStructOfArrayAndPrimitive.
@Test
public void testStructOfArrayAndPrimitive() throws Exception {
Iterable<List<String>> stringArrayField = createNullableTestArrays(transform(intsBetween(0, 31_234), Object::toString));
List<List> values = createTestStructs(stringArrayField, limit(cycle(ImmutableList.of(1, 3, 5, 7, 11, 13, 17)), 31_234));
List<String> structFieldNames = asList("stringArrayField", "intField");
Type structType = RowType.from(asList(field("stringArrayField", new ArrayType(VARCHAR)), field("intField", INTEGER)));
tester.testRoundTrip(getStandardStructObjectInspector(structFieldNames, asList(getStandardListObjectInspector(javaStringObjectInspector), javaIntObjectInspector)), values, values, structType);
}
Aggregations