public static void writeDecimal(OutputStream output, BigDecimal value, int precision, int scale)
            throws IOException {
        if (precision > ClickHouseDataType.Decimal128.getMaxScale()) {
            writeDecimal256(output, value, scale);
        } else if (precision > ClickHouseDataType.Decimal64.getMaxScale()) {
            writeDecimal128(output, value, scale);
        } else if (precision > ClickHouseDataType.Decimal32.getMaxScale()) {
            writeDecimal64(output, value, scale);
        } else {
            writeDecimal32(output, value, scale);
        }
    }
Write a big decimal(4 - 32 bytes) to given output stream.

@param output    non-null output stream
@param value     big decimal
@param precision precision of the decimal
@param scale     scale of the decimal, might be different from
                 {@link java.math.BigDecimal#scale()}
@throws IOException when failed to write value to output stream or reached
                    end of the stream
clickhouse-data/src/main/java/com/clickhouse/data/format/BinaryStreamUtils.java