use of org.apache.carbondata.core.metadata.blocklet.datachunk.DataChunk in project carbondata by apache.
the class CompressedDimensionChunkFileBasedReaderV1 method readRawDimensionChunk.
/**
* Below method will be used to read the raw chunk based on block index
*
* @param fileReader file reader to read the blocks from file
* @param blockletIndex block to be read
* @return dimension column chunk
*/
@Override
public DimensionRawColumnChunk readRawDimensionChunk(FileHolder fileReader, int blockletIndex) throws IOException {
DataChunk dataChunk = dimensionColumnChunk.get(blockletIndex);
ByteBuffer buffer = null;
synchronized (fileReader) {
buffer = fileReader.readByteBuffer(filePath, dataChunk.getDataPageOffset(), dataChunk.getDataPageLength());
}
DimensionRawColumnChunk rawColumnChunk = new DimensionRawColumnChunk(blockletIndex, buffer, 0, dataChunk.getDataPageLength(), this);
rawColumnChunk.setFileHolder(fileReader);
rawColumnChunk.setPagesCount(1);
rawColumnChunk.setRowCount(new int[] { numberOfRows });
return rawColumnChunk;
}
use of org.apache.carbondata.core.metadata.blocklet.datachunk.DataChunk in project carbondata by apache.
the class CarbonUtilTest method testToGetValueCompressionModel.
@Test
public void testToGetValueCompressionModel() {
List<DataChunk> dataChunkList = new ArrayList<>();
DataChunk dataChunk = new DataChunk();
List<Encoding> encodingList = new ArrayList<>();
encodingList.add(Encoding.DELTA);
dataChunk.setEncodingList(encodingList);
List<ValueEncoderMeta> valueEncoderMetas = new ArrayList<>();
ValueEncoderMeta valueEncoderMeta = new ValueEncoderMeta();
valueEncoderMeta.setMaxValue(5.0);
valueEncoderMeta.setMinValue(1.0);
valueEncoderMeta.setUniqueValue(2.0);
valueEncoderMeta.setType('n');
valueEncoderMeta.setDataTypeSelected((byte) 'v');
valueEncoderMetas.add(valueEncoderMeta);
dataChunk.setValueEncoderMeta(valueEncoderMetas);
dataChunkList.add(dataChunk);
WriterCompressModel writerCompressModel = CarbonUtil.getValueCompressionModel(dataChunkList.get(0).getValueEncoderMeta());
assertEquals(1, writerCompressModel.getMaxValue().length);
}
Aggregations