presto-main/src/main/java/io/prestosql/util/JsonUtil.java/BlockBuilderAppender/createBlockBuilderAppender
class BlockBuilderAppender:        static BlockBuilderAppender createBlockBuilderAppender(Type type)
        {
            if (type instanceof BooleanType) {
                return new BooleanBlockBuilderAppender();
            }
            if (type instanceof TinyintType) {
                return new TinyintBlockBuilderAppender();
            }
            if (type instanceof SmallintType) {
                return new SmallintBlockBuilderAppender();
            }
            if (type instanceof IntegerType) {
                return new IntegerBlockBuilderAppender();
            }
            if (type instanceof BigintType) {
                return new BigintBlockBuilderAppender();
            }
            if (type instanceof RealType) {
                return new RealBlockBuilderAppender();
            }
            if (type instanceof DoubleType) {
                return new DoubleBlockBuilderAppender();
            }
            if (type instanceof DecimalType) {
                if (isShortDecimal(type)) {
                    return new ShortDecimalBlockBuilderAppender((DecimalType) type);
                }

                return new LongDecimalBlockBuilderAppender((DecimalType) type);
            }
            if (type instanceof VarcharType) {
                return new VarcharBlockBuilderAppender(type);
            }
            if (type instanceof JsonType) {
                return (parser, blockBuilder) -> {
                    String json = OBJECT_MAPPED_UNORDERED.writeValueAsString(parser.readValueAsTree());
                    JSON.writeSlice(blockBuilder, Slices.utf8Slice(json));
                };
            }
            if (type instanceof ArrayType) {
                return new ArrayBlockBuilderAppender(createBlockBuilderAppender(((ArrayType) type).getElementType()));
            }
            if (type instanceof MapType) {
                MapType mapType = (MapType) type;
                return new MapBlockBuilderAppender(
                        createBlockBuilderAppender(mapType.getKeyType()),
                        createBlockBuilderAppender(mapType.getValueType()),
                        mapType.getKeyType());
            }
            if (type instanceof RowType) {
                RowType rowType = (RowType) type;
                List<Field> rowFields = rowType.getFields();
                BlockBuilderAppender[] fieldAppenders = new BlockBuilderAppender[rowFields.size()];
                for (int i = 0; i < fieldAppenders.length; i++) {
                    fieldAppenders[i] = createBlockBuilderAppender(rowFields.get(i).getType());
                }
                return new RowBlockBuilderAppender(fieldAppenders, getFieldNameToIndex(rowFields));
            }

            throw new PrestoException(INVALID_FUNCTION_ARGUMENT, format("Unsupported type: %s", type));
        }