Search in sources :

Example 1 with ReaderCompressModel

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;
}
Also used : ReaderCompressModel(org.apache.carbondata.core.datastore.compression.ReaderCompressModel)

Example 2 with ReaderCompressModel

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;
}
Also used : ValueCompressionHolder(org.apache.carbondata.core.datastore.compression.ValueCompressionHolder) ReaderCompressModel(org.apache.carbondata.core.datastore.compression.ReaderCompressModel) CarbonReadDataHolder(org.apache.carbondata.core.datastore.dataholder.CarbonReadDataHolder) MeasureColumnDataChunk(org.apache.carbondata.core.datastore.chunk.MeasureColumnDataChunk) DataChunk(org.apache.carbondata.core.metadata.blocklet.datachunk.DataChunk) ValueEncoderMeta(org.apache.carbondata.core.metadata.ValueEncoderMeta) ByteBuffer(java.nio.ByteBuffer) MeasureColumnDataChunk(org.apache.carbondata.core.datastore.chunk.MeasureColumnDataChunk)

Aggregations

ReaderCompressModel (org.apache.carbondata.core.datastore.compression.ReaderCompressModel)2 ByteBuffer (java.nio.ByteBuffer)1 MeasureColumnDataChunk (org.apache.carbondata.core.datastore.chunk.MeasureColumnDataChunk)1 ValueCompressionHolder (org.apache.carbondata.core.datastore.compression.ValueCompressionHolder)1 CarbonReadDataHolder (org.apache.carbondata.core.datastore.dataholder.CarbonReadDataHolder)1 ValueEncoderMeta (org.apache.carbondata.core.metadata.ValueEncoderMeta)1 DataChunk (org.apache.carbondata.core.metadata.blocklet.datachunk.DataChunk)1