in paimon-common/src/main/java/org/apache/paimon/data/serializer/InternalSerializers.java [46:90]
private static Serializer<?> createInternal(DataType type) {
// ordered by type root definition
switch (type.getTypeRoot()) {
case CHAR:
case VARCHAR:
return BinaryStringSerializer.INSTANCE;
case BOOLEAN:
return BooleanSerializer.INSTANCE;
case BINARY:
case VARBINARY:
return BinarySerializer.INSTANCE;
case DECIMAL:
return new DecimalSerializer(getPrecision(type), getScale(type));
case TINYINT:
return ByteSerializer.INSTANCE;
case SMALLINT:
return ShortSerializer.INSTANCE;
case INTEGER:
case DATE:
case TIME_WITHOUT_TIME_ZONE:
return IntSerializer.INSTANCE;
case BIGINT:
return LongSerializer.INSTANCE;
case FLOAT:
return FloatSerializer.INSTANCE;
case DOUBLE:
return DoubleSerializer.INSTANCE;
case TIMESTAMP_WITHOUT_TIME_ZONE:
case TIMESTAMP_WITH_LOCAL_TIME_ZONE:
return new TimestampSerializer(getPrecision(type));
case ARRAY:
return new InternalArraySerializer(((ArrayType) type).getElementType());
case MULTISET:
return new InternalMapSerializer(
((MultisetType) type).getElementType(), new IntType(false));
case MAP:
MapType mapType = (MapType) type;
return new InternalMapSerializer(mapType.getKeyType(), mapType.getValueType());
case ROW:
return new InternalRowSerializer(getFieldTypes(type).toArray(new DataType[0]));
default:
throw new UnsupportedOperationException(
"Unsupported type '" + type + "' to get internal serializer");
}
}