use of org.apache.carbondata.core.datastore.compression.ReaderCompressModel in project carbondata by apache.
the class ValueCompressionUtil method getReaderCompressModel.
/**
* Create Value compression model for read path
*/
public static ReaderCompressModel getReaderCompressModel(ValueEncoderMeta meta) {
ReaderCompressModel compressModel = new ReaderCompressModel();
CompressionFinder compressFinder = getCompressionFinder(meta.getMaxValue(), meta.getMinValue(), meta.getDecimal(), meta.getType(), meta.getDataTypeSelected());
compressModel.setValueCompressionHolder(ValueCompressionUtil.getValueCompressionHolder(compressFinder));
compressModel.setConvertedDataType(compressFinder.getConvertedDataType());
compressModel.setValueEncoderMeta(meta);
return compressModel;
}
use of org.apache.carbondata.core.datastore.compression.ReaderCompressModel in project carbondata by apache.
the class CompressedMeasureChunkFileBasedReaderV1 method convertToMeasureChunk.
@Override
public MeasureColumnDataChunk convertToMeasureChunk(MeasureRawColumnChunk measureRawColumnChunk, int pageNumber) throws IOException {
int blockIndex = measureRawColumnChunk.getBlockletId();
DataChunk dataChunk = measureColumnChunks.get(blockIndex);
ValueEncoderMeta meta = dataChunk.getValueEncoderMeta().get(0);
ReaderCompressModel compressModel = ValueCompressionUtil.getReaderCompressModel(meta);
ValueCompressionHolder values = compressModel.getValueCompressionHolder();
ByteBuffer rawData = measureRawColumnChunk.getRawData();
// unCompress data
values.uncompress(compressModel.getConvertedDataType(), rawData.array(), measureRawColumnChunk.getOffSet(), dataChunk.getDataPageLength(), compressModel.getMantissa(), compressModel.getMaxValue(), numberOfRows);
CarbonReadDataHolder measureDataHolder = new CarbonReadDataHolder(values);
// create and set the data chunk
MeasureColumnDataChunk datChunk = new MeasureColumnDataChunk();
datChunk.setMeasureDataHolder(measureDataHolder);
// set the enun value indexes
datChunk.setNullValueIndexHolder(dataChunk.getNullValueIndexForColumn());
return datChunk;
}
Aggregations