int precision = vectorInfo.measure.getMeasure().getPrecision(); for (int i = 0; i < pageSize; i++) { BigDecimal decimal = decimalConverter.getDecimal(max - pageData[i]); if (decimal.scale() < newScale) { decimal = decimal.setScale(newScale); for (int i = 0; i < size; i += DataTypes.SHORT.getSizeInBytes()) { BigDecimal decimal = decimalConverter.getDecimal(max - ByteUtil.toShortLittleEndian(pageData, i)); if (decimal.scale() < newScale) { decimal = decimal.setScale(newScale); for (int i = 0; i < pageSize; i++) { int shortInt = ByteUtil.valueOf3Bytes(pageData, i * 3); BigDecimal decimal = decimalConverter.getDecimal(max - shortInt); if (decimal.scale() < newScale) { decimal = decimal.setScale(newScale); for (int i = 0; i < size; i += DataTypes.INT.getSizeInBytes()) { BigDecimal decimal = decimalConverter.getDecimal(max - ByteUtil.toIntLittleEndian(pageData, i)); if (decimal.scale() < newScale) { decimal = decimal.setScale(newScale); for (int i = 0; i < size; i += DataTypes.LONG.getSizeInBytes()) { BigDecimal decimal = decimalConverter.getDecimal(max - ByteUtil.toLongLittleEndian(pageData, i)); if (decimal.scale() < newScale) { decimal = decimal.setScale(newScale);
@Override public BigDecimal getDecimal(int rowId) { DecimalConverterFactory.DecimalConverter decimalConverter = ((DecimalColumnPage) columnPage).getDecimalConverter(); DataType dataType = columnPage.getDataType(); if (dataType == DataTypes.BYTE) { return decimalConverter.getDecimal(converter.decodeLong(columnPage.getByte(rowId))); } else if (dataType == DataTypes.SHORT) { return decimalConverter.getDecimal(converter.decodeLong(columnPage.getShort(rowId))); } else if (dataType == DataTypes.SHORT_INT) { return decimalConverter.getDecimal(converter.decodeLong(columnPage.getShortInt(rowId))); } else if (dataType == DataTypes.INT) { return decimalConverter.getDecimal(converter.decodeLong(columnPage.getInt(rowId))); } else if (dataType == DataTypes.LONG || DataTypes.isDecimal(dataType)) { return columnPage.getDecimal(rowId); } else { throw new RuntimeException("internal error: " + this.toString()); } }
private BigDecimal getDecimalFromDecompressData(int rowId) { long value; if (columnPageEncoderMeta.getStoreDataType() == DataTypes.BYTE) { value = getByte(rowId); } else if (columnPageEncoderMeta.getStoreDataType() == DataTypes.SHORT) { value = getShort(rowId); } else if (columnPageEncoderMeta.getStoreDataType() == DataTypes.SHORT_INT) { value = getShortInt(rowId); } else if (columnPageEncoderMeta.getStoreDataType() == DataTypes.INT) { value = getInt(rowId); } else if (columnPageEncoderMeta.getStoreDataType() == DataTypes.LONG) { value = getLong(rowId); } else { return decimalConverter.getDecimal(getBytes(rowId)); } return decimalConverter.getDecimal(value); }
private BigDecimal getDecimalFromRawData(int rowId) { long value; switch (decimalConverter.getDecimalConverterType()) { case DECIMAL_INT: value = getInt(rowId); break; case DECIMAL_LONG: value = getLong(rowId); break; default: value = getByte(rowId); } return decimalConverter.getDecimal(value); }