Search in sources :

Example 16 with DimensionRawColumnChunk

use of org.apache.carbondata.core.datastore.chunk.impl.DimensionRawColumnChunk in project carbondata by apache.

the class CompressedDimensionChunkFileBasedReaderV2 method readRawDimensionChunksInGroup.

/**
   * Below method will be used to read measure chunk data in group.
   * This method will be useful to avoid multiple IO while reading the
   * data from
   *
   * @param fileReader               file reader to read the data
   * @param startColumnBlockletIndex first column blocklet index to be read
   * @param endColumnBlockletIndex   end column blocklet index to be read
   * @return measure raw chunkArray
   * @throws IOException
   */
protected DimensionRawColumnChunk[] readRawDimensionChunksInGroup(FileHolder fileReader, int startColumnBlockletIndex, int endColumnBlockletIndex) throws IOException {
    long currentDimensionOffset = dimensionChunksOffset.get(startColumnBlockletIndex);
    ByteBuffer buffer = null;
    synchronized (fileReader) {
        buffer = fileReader.readByteBuffer(filePath, currentDimensionOffset, (int) (dimensionChunksOffset.get(endColumnBlockletIndex + 1) - currentDimensionOffset));
    }
    DimensionRawColumnChunk[] dataChunks = new DimensionRawColumnChunk[endColumnBlockletIndex - startColumnBlockletIndex + 1];
    int index = 0;
    int runningLength = 0;
    for (int i = startColumnBlockletIndex; i <= endColumnBlockletIndex; i++) {
        int currentLength = (int) (dimensionChunksOffset.get(i + 1) - dimensionChunksOffset.get(i));
        dataChunks[index] = new DimensionRawColumnChunk(i, buffer, runningLength, currentLength, this);
        dataChunks[index].setFileHolder(fileReader);
        dataChunks[index].setPagesCount(1);
        dataChunks[index].setRowCount(new int[] { numberOfRows });
        runningLength += currentLength;
        index++;
    }
    return dataChunks;
}
Also used : DimensionRawColumnChunk(org.apache.carbondata.core.datastore.chunk.impl.DimensionRawColumnChunk) ByteBuffer(java.nio.ByteBuffer)

Aggregations

DimensionRawColumnChunk (org.apache.carbondata.core.datastore.chunk.impl.DimensionRawColumnChunk)16 BitSet (java.util.BitSet)9 BitSetGroup (org.apache.carbondata.core.util.BitSetGroup)9 ByteBuffer (java.nio.ByteBuffer)5 DimensionColumnDataChunk (org.apache.carbondata.core.datastore.chunk.DimensionColumnDataChunk)4 MeasureRawColumnChunk (org.apache.carbondata.core.datastore.chunk.impl.MeasureRawColumnChunk)3 QueryStatistic (org.apache.carbondata.core.stats.QueryStatistic)3 MeasureColumnDataChunk (org.apache.carbondata.core.datastore.chunk.MeasureColumnDataChunk)2 BlockletDeleteDeltaCacheLoader (org.apache.carbondata.core.mutate.data.BlockletDeleteDeltaCacheLoader)2 DeleteDeltaCacheLoaderIntf (org.apache.carbondata.core.mutate.data.DeleteDeltaCacheLoaderIntf)2 AbstractScannedResult (org.apache.carbondata.core.scan.result.AbstractScannedResult)2 DataChunk3 (org.apache.carbondata.format.DataChunk3)2 FileHolder (org.apache.carbondata.core.datastore.FileHolder)1 ColumnGroupDimensionDataChunk (org.apache.carbondata.core.datastore.chunk.impl.ColumnGroupDimensionDataChunk)1 FixedLengthDimensionDataChunk (org.apache.carbondata.core.datastore.chunk.impl.FixedLengthDimensionDataChunk)1 VariableLengthDimensionDataChunk (org.apache.carbondata.core.datastore.chunk.impl.VariableLengthDimensionDataChunk)1 DataChunk (org.apache.carbondata.core.metadata.blocklet.datachunk.DataChunk)1 FilterQueryScannedResult (org.apache.carbondata.core.scan.result.impl.FilterQueryScannedResult)1 NonFilterQueryScannedResult (org.apache.carbondata.core.scan.result.impl.NonFilterQueryScannedResult)1