Search in sources :

Example 1 with RepeatedTypeMapping

use of org.apache.parquet.arrow.schema.SchemaMapping.RepeatedTypeMapping in project parquet-mr by apache.

the class SchemaConverter method fromParquet.

/**
 * @param type parquet type
 * @param name overrides parquet.getName)
 * @param repetition overrides parquet.getRepetition()
 * @return
 */
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);
    }
}
Also used : Field(org.apache.arrow.vector.types.pojo.Field) ArrowType(org.apache.arrow.vector.types.pojo.ArrowType) PrimitiveTypeMapping(org.apache.parquet.arrow.schema.SchemaMapping.PrimitiveTypeMapping) RepeatedTypeMapping(org.apache.parquet.arrow.schema.SchemaMapping.RepeatedTypeMapping) UnionTypeMapping(org.apache.parquet.arrow.schema.SchemaMapping.UnionTypeMapping) ListTypeMapping(org.apache.parquet.arrow.schema.SchemaMapping.ListTypeMapping) StructTypeMapping(org.apache.parquet.arrow.schema.SchemaMapping.StructTypeMapping) TypeMapping(org.apache.parquet.arrow.schema.SchemaMapping.TypeMapping) RepeatedTypeMapping(org.apache.parquet.arrow.schema.SchemaMapping.RepeatedTypeMapping)

Aggregations

ArrowType (org.apache.arrow.vector.types.pojo.ArrowType)1 Field (org.apache.arrow.vector.types.pojo.Field)1 ListTypeMapping (org.apache.parquet.arrow.schema.SchemaMapping.ListTypeMapping)1 PrimitiveTypeMapping (org.apache.parquet.arrow.schema.SchemaMapping.PrimitiveTypeMapping)1 RepeatedTypeMapping (org.apache.parquet.arrow.schema.SchemaMapping.RepeatedTypeMapping)1 StructTypeMapping (org.apache.parquet.arrow.schema.SchemaMapping.StructTypeMapping)1 TypeMapping (org.apache.parquet.arrow.schema.SchemaMapping.TypeMapping)1 UnionTypeMapping (org.apache.parquet.arrow.schema.SchemaMapping.UnionTypeMapping)1