public Decimal getDecimal()

in src/main/java/org/apache/paimon/trino/TrinoRow.java [133:149]


    public Decimal getDecimal(int i, int decimalPrecision, int decimalScale) {
        Object value =
                TypeUtils.readNativeValue(
                        DecimalType.createDecimalType(decimalPrecision, decimalScale),
                        singlePage.getBlock(i),
                        0);
        if (decimalPrecision <= MAX_SHORT_PRECISION) {
            return Decimal.fromUnscaledLong((Long) value, decimalPrecision, decimalScale);
        } else {
            long high = ((Int128) value).getHigh();
            long low = ((Int128) value).getLow();
            BigInteger bigIntegerValue =
                    BigInteger.valueOf(high).shiftLeft(64).add(BigInteger.valueOf(low));
            BigDecimal bigDecimalValue = new BigDecimal(bigIntegerValue, decimalScale);
            return Decimal.fromBigDecimal(bigDecimalValue, decimalPrecision, decimalScale);
        }
    }