use of org.apache.parquet.arrow.schema.SchemaMapping.StructTypeMapping in project parquet-mr by apache.
the class SchemaConverter method fromParquetGroup.
/**
* @param type parquet types
* @param name overrides parquet.getName()
* @return the mapping
*/
private TypeMapping fromParquetGroup(GroupType type, String name) {
OriginalType ot = type.getOriginalType();
if (ot == null) {
List<TypeMapping> typeMappings = fromParquet(type.getFields());
Field arrowField = new Field(name, type.isRepetition(OPTIONAL), new Struct_(), fields(typeMappings));
return new StructTypeMapping(arrowField, type, typeMappings);
} else {
switch(ot) {
case LIST:
List3Levels list3Levels = new List3Levels(type);
TypeMapping child = fromParquet(list3Levels.getElement(), null, list3Levels.getElement().getRepetition());
Field arrowField = new Field(name, type.isRepetition(OPTIONAL), new ArrowType.List(), asList(child.getArrowField()));
return new ListTypeMapping(arrowField, list3Levels, child);
default:
throw new UnsupportedOperationException("Unsupported type " + type);
}
}
}
Aggregations