presto-rcfile/src/main/java/io/prestosql/rcfile/text/DecimalEncoding.java/DecimalEncoding/parseBigDecimal
class DecimalEncoding:    private BigDecimal parseBigDecimal(Slice slice, int offset, int length)
    {
        checkArgument(length < buffer.length);
        for (int i = 0; i < length; i++) {
            buffer[i] = (char) slice.getByte(offset + i);
        }

        BigDecimal decimal = new BigDecimal(buffer, 0, length);

        checkState(decimal.scale() <= type.getScale(), "Read decimal value scale larger than column scale");
        decimal = decimal.setScale(type.getScale(), HALF_UP);
        checkState(decimal.precision() <= type.getPrecision(), "Read decimal precision larger than column precision");
        return decimal;
    }