Search in sources :

Example 1 with FieldsPath

use of org.apache.parquet.thrift.projection.FieldsPath in project parquet-mr by apache.

the class ThriftSchemaConvertVisitor method convert.

public static MessageType convert(StructType struct, FieldProjectionFilter filter, boolean keepOneOfEachUnion) {
    State state = new State(new FieldsPath(), REPEATED, "ParquetSchema");
    ConvertedField converted = struct.accept(new ThriftSchemaConvertVisitor(filter, true, keepOneOfEachUnion), state);
    if (!converted.isKeep()) {
        throw new ThriftProjectionException("No columns have been selected");
    }
    return new MessageType(state.name, converted.asKeep().getType().asGroupType().getFields());
}
Also used : FieldsPath(org.apache.parquet.thrift.projection.FieldsPath) ThriftProjectionException(org.apache.parquet.thrift.projection.ThriftProjectionException) MessageType(org.apache.parquet.schema.MessageType)

Aggregations

MessageType (org.apache.parquet.schema.MessageType)1 FieldsPath (org.apache.parquet.thrift.projection.FieldsPath)1 ThriftProjectionException (org.apache.parquet.thrift.projection.ThriftProjectionException)1