presto-rcfile/src/main/java/io/prestosql/rcfile/RcFileEncoding.java/RcFileEncoding/getEncoding
class RcFileEncoding:    default ColumnEncoding getEncoding(Type type)
    {
        if (BOOLEAN.equals(type)) {
            return booleanEncoding(type);
        }
        if (TINYINT.equals(type)) {
            return byteEncoding(type);
        }
        if (SMALLINT.equals(type)) {
            return shortEncoding(type);
        }
        if (INTEGER.equals(type)) {
            return intEncoding(type);
        }
        if (BIGINT.equals(type)) {
            return longEncoding(type);
        }
        if (type instanceof DecimalType) {
            return decimalEncoding(type);
        }
        if (REAL.equals(type)) {
            return floatEncoding(type);
        }
        if (DOUBLE.equals(type)) {
            return doubleEncoding(type);
        }
        if (type instanceof VarcharType || type instanceof CharType) {
            return stringEncoding(type);
        }
        if (VARBINARY.equals(type)) {
            return binaryEncoding(type);
        }
        if (DATE.equals(type)) {
            return dateEncoding(type);
        }
        if (TIMESTAMP.equals(type)) {
            return timestampEncoding(type);
        }
        if (type instanceof ArrayType) {
            ColumnEncoding elementType = getEncoding(type.getTypeParameters().get(0));
            return listEncoding(type, elementType);
        }
        if (type instanceof MapType) {
            ColumnEncoding keyType = getEncoding(type.getTypeParameters().get(0));
            ColumnEncoding valueType = getEncoding(type.getTypeParameters().get(1));
            return mapEncoding(type, keyType, valueType);
        }
        if (type instanceof RowType) {
            return structEncoding(
                    type,
                    type.getTypeParameters().stream()
                            .map(this::getEncoding)
                            .collect(toList()));
        }
        throw new PrestoException(NOT_SUPPORTED, "unsupported type: " + type);
    }