presto-main/src/main/java/io/prestosql/operator/aggregation/minmaxby/TwoNullableValueStateMapping.java/TwoNullableValueStateMapping/getStateSerializer
class TwoNullableValueStateMapping:    public static AccumulatorStateSerializer<?> getStateSerializer(Type firstType, Type secondType)
    {
        Class<?> firstJavaType = firstType.getJavaType();
        Class<?> secondJavaType = secondType.getJavaType();

        if (secondJavaType != Block.class && secondJavaType != Slice.class) {
            throw new IllegalArgumentException(format("Unsupported state type combination: (%s, %s)", firstJavaType.getName(), secondJavaType.getName()));
        }
        if (firstJavaType == boolean.class) {
            return new BooleanAndBlockPositionStateSerializer(firstType, secondType);
        }
        if (firstJavaType == long.class) {
            return new LongAndBlockPositionStateSerializer(firstType, secondType);
        }
        if (firstJavaType == double.class) {
            return new DoubleAndBlockPositionStateSerializer(firstType, secondType);
        }
        if (firstJavaType == Slice.class) {
            return new SliceAndBlockPositionStateSerializer(firstType, secondType);
        }
        if (firstJavaType == Block.class) {
            return new BlockAndBlockPositionStateSerializer(firstType, secondType);
        }
        throw new IllegalArgumentException(format("Unsupported state type combination: (%s, %s)", firstJavaType.getName(), secondJavaType.getName()));
    }