use of org.apache.carbondata.core.datastore.compression.Compressor in project carbondata by apache.
the class ColumnPage method decompressDecimalPage.
/**
* Decompress data and create a decimal column page using the decompressed data
*/
public static ColumnPage decompressDecimalPage(ColumnPageEncoderMeta meta, byte[] compressedData, int offset, int length) throws MemoryException {
Compressor compressor = CompressorFactory.getInstance().getCompressor(meta.getCompressorName());
TableSpec.ColumnSpec columnSpec = meta.getColumnSpec();
ColumnPage decimalPage = null;
DataType storeDataType = meta.getStoreDataType();
if (storeDataType == DataTypes.BYTE) {
byte[] byteData = compressor.unCompressByte(compressedData, offset, length);
decimalPage = createDecimalPage(columnSpec, meta.getStoreDataType(), byteData.length);
decimalPage.setBytePage(byteData);
return decimalPage;
} else if (storeDataType == DataTypes.SHORT) {
short[] shortData = compressor.unCompressShort(compressedData, offset, length);
decimalPage = createDecimalPage(columnSpec, meta.getStoreDataType(), shortData.length);
decimalPage.setShortPage(shortData);
return decimalPage;
} else if (storeDataType == DataTypes.SHORT_INT) {
byte[] shortIntData = compressor.unCompressByte(compressedData, offset, length);
decimalPage = createDecimalPage(columnSpec, meta.getStoreDataType(), shortIntData.length);
decimalPage.setShortIntPage(shortIntData);
return decimalPage;
} else if (storeDataType == DataTypes.INT) {
int[] intData = compressor.unCompressInt(compressedData, offset, length);
decimalPage = createDecimalPage(columnSpec, meta.getStoreDataType(), intData.length);
decimalPage.setIntPage(intData);
return decimalPage;
} else if (storeDataType == DataTypes.LONG) {
long[] longData = compressor.unCompressLong(compressedData, offset, length);
decimalPage = createDecimalPage(columnSpec, meta.getStoreDataType(), longData.length);
decimalPage.setLongPage(longData);
return decimalPage;
} else {
byte[] lvEncodedBytes = compressor.unCompressByte(compressedData, offset, length);
return newDecimalPage(columnSpec, lvEncodedBytes);
}
}
Aggregations