private ClickHouseColumn readDynamicData() throws IOException {
        byte tag = readByte();

        ClickHouseDataType type;
        if (tag == ClickHouseDataType.INTERVAL_BIN_TAG) {
            byte intervalKind = readByte();
            type = ClickHouseDataType.intervalKind2Type.get(intervalKind);
            if (type == null) {
                throw new ClientException("Unsupported interval kind: " + intervalKind);
            }
            return ClickHouseColumn.of("v", type, false, 0, 0);
        } else if (tag == ClickHouseDataType.DateTime32.getBinTag()) {
            byte scale = readByte();
            return ClickHouseColumn.of("v", "DateTime32(" + scale + ")");
        }  else if (tag == ClickHouseDataType.DateTime64.getBinTag() - 1) { // without timezone
            byte scale = readByte();
            return ClickHouseColumn.of("v", "DateTime64(" + scale  +")");
        }  else if (tag == ClickHouseDataType.DateTime64.getBinTag()) {
            byte scale = readByte();
            String timezone = readString(input);
            return ClickHouseColumn.of("v", "DateTime64(" + scale + (timezone.isEmpty() ? "" : ", " + timezone) +")");
        } else if (tag == ClickHouseDataType.CUSTOM_TYPE_BIN_TAG) {
            String typeName = readString(input);
            return ClickHouseColumn.of("v", typeName);
        } else if (DECIMAL_TAGS.contains(tag)) {
            int precision = readByte();
            int scale = readByte();
            return ClickHouseColumn.of("v", ClickHouseDataType.binTag2Type.get(tag), false, precision, scale);
        } else if (tag == ClickHouseDataType.Array.getBinTag()) {
            ClickHouseColumn elementColumn = readDynamicData();
            return ClickHouseColumn.of("v", "Array(" + elementColumn.getOriginalTypeName() + ")");
        } else if (tag == ClickHouseDataType.Map.getBinTag()) {
            ClickHouseColumn keyInfo = readDynamicData();
            ClickHouseColumn valueInfo = readDynamicData();
            return ClickHouseColumn.of("v", "Map(" + keyInfo.getOriginalTypeName() + "," + valueInfo.getOriginalTypeName() + ")");
        } else if (tag == ClickHouseDataType.Enum8.getBinTag() || tag == ClickHouseDataType.Enum16.getBinTag()) {
            int constants = readVarInt(input);
            int[] values = new int[constants];
            String[] names = new String[constants];
            ClickHouseDataType enumType = constants > 127 ? ClickHouseDataType.Enum16 : ClickHouseDataType.Enum8;
            for (int i = 0; i < constants; i++) {
                names[i] = readString(input);
                if (enumType == ClickHouseDataType.Enum8) {
                    values[i] = readUnsignedByte();
                } else {
                    values[i] = readUnsignedShortLE();
                }
            }
            return new ClickHouseColumn(enumType, "v", enumType.name(), false, false, Collections.emptyList(), Collections.emptyList(),
                    new ClickHouseEnum(names, values));
        } else if (tag == ClickHouseDataType.NULLABLE_BIN_TAG) {
            ClickHouseColumn column = readDynamicData();
            return ClickHouseColumn.of("v", "Nullable(" + column.getOriginalTypeName() + ")");
        } else {
            type = ClickHouseDataType.binTag2Type.get(tag);
            if (type == null) {
                throw new ClientException("Unsupported data type with tag " + tag);
            }
            return ClickHouseColumn.of("v", type, false, 0, 0);
        }
    }
Byte allocator that caches preallocated byte arrays for small sizes.
client-v2/src/main/java/com/clickhouse/client/api/data_formats/internal/BinaryStreamReader.java