in parquet-column/src/main/java/org/apache/parquet/schema/LogicalTypeAnnotation.java [241:296]
public static LogicalTypeAnnotation fromOriginalType(OriginalType originalType, DecimalMetadata decimalMetadata) {
if (originalType == null) {
return null;
}
switch (originalType) {
case UTF8:
return stringType();
case MAP:
return mapType();
case DECIMAL:
int scale = (decimalMetadata == null ? 0 : decimalMetadata.getScale());
int precision = (decimalMetadata == null ? 0 : decimalMetadata.getPrecision());
return decimalType(scale, precision);
case LIST:
return listType();
case DATE:
return dateType();
case INTERVAL:
return IntervalLogicalTypeAnnotation.getInstance();
case TIMESTAMP_MILLIS:
return timestampType(true, LogicalTypeAnnotation.TimeUnit.MILLIS);
case TIMESTAMP_MICROS:
return timestampType(true, LogicalTypeAnnotation.TimeUnit.MICROS);
case TIME_MILLIS:
return timeType(true, LogicalTypeAnnotation.TimeUnit.MILLIS);
case TIME_MICROS:
return timeType(true, LogicalTypeAnnotation.TimeUnit.MICROS);
case UINT_8:
return intType(8, false);
case UINT_16:
return intType(16, false);
case UINT_32:
return intType(32, false);
case UINT_64:
return intType(64, false);
case INT_8:
return intType(8, true);
case INT_16:
return intType(16, true);
case INT_32:
return intType(32, true);
case INT_64:
return intType(64, true);
case ENUM:
return enumType();
case JSON:
return jsonType();
case BSON:
return bsonType();
case MAP_KEY_VALUE:
return MapKeyValueTypeAnnotation.getInstance();
default:
throw new RuntimeException(
"Can't convert original type to logical type, unknown original type " + originalType);
}
}