Search in sources :

Example 1 with ConvertedType

use of org.apache.parquet.format.ConvertedType in project drill by apache.

the class ParquetToDrillTypeConverter method toMajorType.

public static TypeProtos.MajorType toMajorType(PrimitiveType.PrimitiveTypeName primitiveTypeName, int length, TypeProtos.DataMode mode, SchemaElement schemaElement, OptionManager options) {
    ConvertedType convertedType = schemaElement.getConverted_type();
    MinorType minorType = getMinorType(primitiveTypeName, length, convertedType, options);
    TypeProtos.MajorType.Builder typeBuilder = TypeProtos.MajorType.newBuilder().setMinorType(minorType).setMode(mode);
    if (Types.isDecimalType(minorType)) {
        int precision = schemaElement.getPrecision();
        int scale = schemaElement.getScale();
        typeBuilder.setPrecision(precision).setScale(scale);
    }
    return typeBuilder.build();
}
Also used : ConvertedType(org.apache.parquet.format.ConvertedType) MinorType(org.apache.drill.common.types.TypeProtos.MinorType)

Aggregations

MinorType (org.apache.drill.common.types.TypeProtos.MinorType)1 ConvertedType (org.apache.parquet.format.ConvertedType)1