public static BigDecimal readDecimal(ClickHouseInputStream input, int precision, int scale) throws IOException {
        BigDecimal v;

        if (precision <= ClickHouseDataType.Decimal32.getMaxScale()) {
            v = readDecimal32(input, scale);
        } else if (precision <= ClickHouseDataType.Decimal64.getMaxScale()) {
            v = readDecimal64(input, scale);
        } else if (precision <= ClickHouseDataType.Decimal128.getMaxScale()) {
            v = readDecimal128(input, scale);
        } else {
            v = readDecimal256(input, scale);
        }

        return v;
    }
Read big decimal(4 - 32 bytes) from given input stream.

@param input     non-null input stream
@param precision precision of the decimal
@param scale     scale of the decimal
@return big decimal
@throws IOException when failed to read value from input stream or reached
                    end of the stream
clickhouse-data/src/main/java/com/clickhouse/data/format/BinaryStreamUtils.java