/** * @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); } } }
/** * @param type parquet type * @param name overrides parquet.getName) * @param repetition overrides parquet.getRepetition() * @return a type mapping from the Parquet type to an Arrow type */ private TypeMapping fromParquet(Type type, String name, Repetition repetition) { if (repetition == REPEATED) { // case where we have a repeated field that is not in a List/Map TypeMapping child = fromParquet(type, null, REQUIRED); Field arrowField = new Field(name, false, new ArrowType.List(), asList(child.getArrowField())); return new RepeatedTypeMapping(arrowField, type, child); } if (type.isPrimitive()) { return fromParquetPrimitive(type.asPrimitiveType(), name); } else { return fromParquetGroup(type.asGroupType(), name); } }
return new ArrowType.List();
public ListVector addOrGetList(String name) { return addOrGet(name, FieldType.nullable(new List()), ListVector.class); }