Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
jackylk committed Jan 30, 2018
1 parent 0e0b1f2 commit 0e9130c
Show file tree
Hide file tree
Showing 86 changed files with 422 additions and 706 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public interface DataRefNode {
* data in one IO operation
* @return dimension data chunks
*/
DimensionRawColumnChunk[] readDimensionChunks(FileHolder fileReader, int[][] columnIndexRange)
DimensionRawColumnChunk[] readDimensionChunks(FileReader fileReader, int[][] columnIndexRange)
throws IOException;

/**
Expand All @@ -92,7 +92,7 @@ DimensionRawColumnChunk[] readDimensionChunks(FileHolder fileReader, int[][] col
* @param fileReader file reader to read the chunk from file
* @return dimension data chunk
*/
DimensionRawColumnChunk readDimensionChunk(FileHolder fileReader, int columnIndex)
DimensionRawColumnChunk readDimensionChunk(FileReader fileReader, int columnIndex)
throws IOException;

/**
Expand All @@ -107,7 +107,7 @@ DimensionRawColumnChunk readDimensionChunk(FileHolder fileReader, int columnInde
* data in one IO operation
* @return measure column data chunk
*/
MeasureRawColumnChunk[] readMeasureChunks(FileHolder fileReader, int[][] columnIndexRange)
MeasureRawColumnChunk[] readMeasureChunks(FileReader fileReader, int[][] columnIndexRange)
throws IOException;

/**
Expand All @@ -117,6 +117,6 @@ MeasureRawColumnChunk[] readMeasureChunks(FileHolder fileReader, int[][] columnI
* @param columnIndex block index to be read from file
* @return measure data chunk
*/
MeasureRawColumnChunk readMeasureChunk(FileHolder fileReader, int columnIndex) throws IOException;
MeasureRawColumnChunk readMeasureChunk(FileReader fileReader, int columnIndex) throws IOException;

}
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,10 @@

package org.apache.carbondata.core.datastore;

import java.io.DataInputStream;
import java.io.IOException;
import java.nio.ByteBuffer;

public interface FileHolder {
public interface FileReader {

/**
* This method will be used to reads the data to byteBuffer from file based on offset
Expand Down Expand Up @@ -99,10 +98,4 @@ ByteBuffer readByteBuffer(String filePath, long offset, int length)
*/
void finish() throws IOException;

void setQueryId(String queryId);

String getQueryId();

DataInputStream getDataInputStream(String filePath, long offset) throws IOException;

}
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public abstract class AbstractDimensionColumnPage implements DimensionColumnPage
/**
* data chunks
*/
protected DimensionDataChunkStore dataChunkStore;
DimensionDataChunkStore dataChunkStore;

/**
* @return whether columns where explicitly sorted or not
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import java.io.IOException;
import java.nio.ByteBuffer;

import org.apache.carbondata.core.datastore.FileHolder;
import org.apache.carbondata.core.datastore.FileReader;
import org.apache.carbondata.core.datastore.chunk.AbstractRawColumnChunk;
import org.apache.carbondata.core.datastore.chunk.DimensionColumnPage;
import org.apache.carbondata.core.datastore.chunk.reader.DimensionColumnChunkReader;
Expand All @@ -37,7 +37,7 @@ public class DimensionRawColumnChunk extends AbstractRawColumnChunk {

private DimensionColumnChunkReader chunkReader;

private FileHolder fileHolder;
private FileReader fileReader;

public DimensionRawColumnChunk(int columnIndex, ByteBuffer rawData, int offSet, int length,
DimensionColumnChunkReader columnChunkReader) {
Expand Down Expand Up @@ -96,11 +96,11 @@ public DimensionColumnPage decodeColumnPage(int pageNumber) {
}
}

public void setFileHolder(FileHolder fileHolder) {
this.fileHolder = fileHolder;
public void setFileReader(FileReader fileReader) {
this.fileReader = fileReader;
}

public FileHolder getFileReader() {
return fileHolder;
public FileReader getFileReader() {
return fileReader;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import java.io.IOException;
import java.nio.ByteBuffer;

import org.apache.carbondata.core.datastore.FileHolder;
import org.apache.carbondata.core.datastore.chunk.AbstractRawColumnChunk;
import org.apache.carbondata.core.datastore.chunk.reader.MeasureColumnChunkReader;
import org.apache.carbondata.core.datastore.page.ColumnPage;
Expand All @@ -37,8 +36,6 @@ public class MeasureRawColumnChunk extends AbstractRawColumnChunk {

private MeasureColumnChunkReader chunkReader;

private FileHolder fileReader;

public MeasureRawColumnChunk(int columnIndex, ByteBuffer rawData, int offSet, int length,
MeasureColumnChunkReader chunkReader) {
super(columnIndex, rawData, offSet, length);
Expand Down Expand Up @@ -95,8 +92,4 @@ public ColumnPage decodeColumnPage(int pageNumber) {
}
}

public void setFileReader(FileHolder fileReader) {
this.fileReader = fileReader;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

import java.io.IOException;

import org.apache.carbondata.core.datastore.FileHolder;
import org.apache.carbondata.core.datastore.FileReader;
import org.apache.carbondata.core.datastore.chunk.DimensionColumnPage;
import org.apache.carbondata.core.datastore.chunk.impl.DimensionRawColumnChunk;
import org.apache.carbondata.core.memory.MemoryException;
Expand All @@ -37,7 +37,7 @@ public interface DimensionColumnChunkReader {
* @param columnIndexRange blocklets to be read
* @return dimension column chunks
*/
DimensionRawColumnChunk[] readRawDimensionChunks(FileHolder fileReader, int[][] columnIndexRange)
DimensionRawColumnChunk[] readRawDimensionChunks(FileReader fileReader, int[][] columnIndexRange)
throws IOException;

/**
Expand All @@ -47,7 +47,7 @@ DimensionRawColumnChunk[] readRawDimensionChunks(FileHolder fileReader, int[][]
* @param columnIndex column to be read
* @return dimension column chunk
*/
DimensionRawColumnChunk readRawDimensionChunk(FileHolder fileReader, int columnIndex)
DimensionRawColumnChunk readRawDimensionChunk(FileReader fileReader, int columnIndex)
throws IOException;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

import java.io.IOException;

import org.apache.carbondata.core.datastore.FileHolder;
import org.apache.carbondata.core.datastore.FileReader;
import org.apache.carbondata.core.datastore.chunk.impl.MeasureRawColumnChunk;
import org.apache.carbondata.core.datastore.page.ColumnPage;
import org.apache.carbondata.core.memory.MemoryException;
Expand All @@ -35,7 +35,7 @@ public interface MeasureColumnChunkReader {
* @param columnIndexRange blocks to be read
* @return measure data chunks
*/
MeasureRawColumnChunk[] readRawMeasureChunks(FileHolder fileReader, int[][] columnIndexRange)
MeasureRawColumnChunk[] readRawMeasureChunks(FileReader fileReader, int[][] columnIndexRange)
throws IOException;

/**
Expand All @@ -45,7 +45,7 @@ MeasureRawColumnChunk[] readRawMeasureChunks(FileHolder fileReader, int[][] colu
* @param columnIndex block to be read
* @return measure data chunk
*/
MeasureRawColumnChunk readRawMeasureChunk(FileHolder fileReader, int columnIndex)
MeasureRawColumnChunk readRawMeasureChunk(FileReader fileReader, int columnIndex)
throws IOException;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import java.io.IOException;
import java.util.List;

import org.apache.carbondata.core.datastore.FileHolder;
import org.apache.carbondata.core.datastore.FileReader;
import org.apache.carbondata.core.datastore.chunk.impl.DimensionRawColumnChunk;
import org.apache.carbondata.core.metadata.blocklet.BlockletInfo;
import org.apache.carbondata.format.Encoding;
Expand Down Expand Up @@ -58,7 +58,7 @@ public AbstractChunkReaderV2V3Format(final BlockletInfo blockletInfo,
* @param columnIndexRange column index range to be read
* @return dimension column chunks
*/
@Override public DimensionRawColumnChunk[] readRawDimensionChunks(final FileHolder fileReader,
@Override public DimensionRawColumnChunk[] readRawDimensionChunks(final FileReader fileReader,
final int[][] columnIndexRange) throws IOException {
// read the column chunk based on block index and add
DimensionRawColumnChunk[] dataChunks =
Expand Down Expand Up @@ -109,7 +109,7 @@ public AbstractChunkReaderV2V3Format(final BlockletInfo blockletInfo,
* @return measure raw chunkArray
* @throws IOException
*/
protected abstract DimensionRawColumnChunk[] readRawDimensionChunksInGroup(FileHolder fileReader,
protected abstract DimensionRawColumnChunk[] readRawDimensionChunksInGroup(FileReader fileReader,
int startColumnBlockletIndex, int endColumnBlockletIndex) throws IOException;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import java.nio.ByteBuffer;
import java.util.List;

import org.apache.carbondata.core.datastore.FileHolder;
import org.apache.carbondata.core.datastore.FileReader;
import org.apache.carbondata.core.datastore.chunk.DimensionColumnPage;
import org.apache.carbondata.core.datastore.chunk.impl.ColumnGroupDimensionColumnPage;
import org.apache.carbondata.core.datastore.chunk.impl.DimensionRawColumnChunk;
Expand Down Expand Up @@ -64,7 +64,7 @@ public CompressedDimensionChunkFileBasedReaderV1(final BlockletInfo blockletInfo
* @param columnIndexRange blocks to be read
* @return dimension column chunks
*/
@Override public DimensionRawColumnChunk[] readRawDimensionChunks(FileHolder fileReader,
@Override public DimensionRawColumnChunk[] readRawDimensionChunks(FileReader fileReader,
int[][] columnIndexRange) throws IOException {
DimensionRawColumnChunk[] dataChunks = new DimensionRawColumnChunk[dimensionColumnChunk.size()];
for (int i = 0; i < columnIndexRange.length; i++) {
Expand All @@ -82,7 +82,7 @@ public CompressedDimensionChunkFileBasedReaderV1(final BlockletInfo blockletInfo
* @param columnIndex column to be read
* @return dimension column chunk
*/
@Override public DimensionRawColumnChunk readRawDimensionChunk(FileHolder fileReader,
@Override public DimensionRawColumnChunk readRawDimensionChunk(FileReader fileReader,
int columnIndex) throws IOException {
DataChunk dataChunk = dimensionColumnChunk.get(columnIndex);
ByteBuffer buffer = null;
Expand All @@ -92,7 +92,7 @@ public CompressedDimensionChunkFileBasedReaderV1(final BlockletInfo blockletInfo
}
DimensionRawColumnChunk rawColumnChunk = new DimensionRawColumnChunk(columnIndex, buffer, 0,
dataChunk.getDataPageLength(), this);
rawColumnChunk.setFileHolder(fileReader);
rawColumnChunk.setFileReader(fileReader);
rawColumnChunk.setPagesCount(1);
rawColumnChunk.setRowCount(new int[] { numberOfRows });
return rawColumnChunk;
Expand All @@ -105,7 +105,7 @@ public CompressedDimensionChunkFileBasedReaderV1(final BlockletInfo blockletInfo
int[] invertedIndexes = null;
int[] invertedIndexesReverse = null;
int[] rlePage = null;
FileHolder fileReader = dimensionRawColumnChunk.getFileReader();
FileReader fileReader = dimensionRawColumnChunk.getFileReader();

ByteBuffer rawData = dimensionRawColumnChunk.getRawData();
dataPage = COMPRESSOR.unCompressByte(rawData.array(), dimensionRawColumnChunk.getOffSet(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import java.io.IOException;
import java.nio.ByteBuffer;

import org.apache.carbondata.core.datastore.FileHolder;
import org.apache.carbondata.core.datastore.FileReader;
import org.apache.carbondata.core.datastore.chunk.DimensionColumnPage;
import org.apache.carbondata.core.datastore.chunk.impl.ColumnGroupDimensionColumnPage;
import org.apache.carbondata.core.datastore.chunk.impl.DimensionRawColumnChunk;
Expand Down Expand Up @@ -56,7 +56,7 @@ public CompressedDimensionChunkFileBasedReaderV2(final BlockletInfo blockletInfo
* @param columnIndex column to be read
* @return dimension column chunk
*/
public DimensionRawColumnChunk readRawDimensionChunk(FileHolder fileReader, int columnIndex)
public DimensionRawColumnChunk readRawDimensionChunk(FileReader fileReader, int columnIndex)
throws IOException {
int length = 0;
if (dimensionChunksOffset.size() - 1 == columnIndex) {
Expand All @@ -73,7 +73,7 @@ public DimensionRawColumnChunk readRawDimensionChunk(FileHolder fileReader, int
}
DimensionRawColumnChunk rawColumnChunk =
new DimensionRawColumnChunk(columnIndex, buffer, 0, length, this);
rawColumnChunk.setFileHolder(fileReader);
rawColumnChunk.setFileReader(fileReader);
rawColumnChunk.setPagesCount(1);
rawColumnChunk.setRowCount(new int[] { numberOfRows });
return rawColumnChunk;
Expand All @@ -90,7 +90,7 @@ public DimensionRawColumnChunk readRawDimensionChunk(FileHolder fileReader, int
* @return measure raw chunkArray
* @throws IOException
*/
protected DimensionRawColumnChunk[] readRawDimensionChunksInGroup(FileHolder fileReader,
protected DimensionRawColumnChunk[] readRawDimensionChunksInGroup(FileReader fileReader,
int startColumnBlockletIndex, int endColumnBlockletIndex) throws IOException {
long currentDimensionOffset = dimensionChunksOffset.get(startColumnBlockletIndex);
ByteBuffer buffer = null;
Expand All @@ -106,7 +106,7 @@ protected DimensionRawColumnChunk[] readRawDimensionChunksInGroup(FileHolder fil
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].setFileReader(fileReader);
dataChunks[index].setPagesCount(1);
dataChunks[index].setRowCount(new int[] { numberOfRows });
runningLength += currentLength;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import java.nio.ByteBuffer;
import java.util.List;

import org.apache.carbondata.core.datastore.FileHolder;
import org.apache.carbondata.core.datastore.FileReader;
import org.apache.carbondata.core.datastore.chunk.DimensionColumnPage;
import org.apache.carbondata.core.datastore.chunk.impl.DimensionRawColumnChunk;
import org.apache.carbondata.core.datastore.chunk.impl.FixedLengthDimensionColumnPage;
Expand Down Expand Up @@ -81,7 +81,7 @@ public CompressedDimensionChunkFileBasedReaderV3(BlockletInfo blockletInfo,
* @param columnIndex blocklet index of the column in carbon data file
* @return dimension raw chunk
*/
public DimensionRawColumnChunk readRawDimensionChunk(FileHolder fileReader,
public DimensionRawColumnChunk readRawDimensionChunk(FileReader fileReader,
int columnIndex) throws IOException {
// get the current dimension offset
long currentDimensionOffset = dimensionChunksOffset.get(columnIndex);
Expand Down Expand Up @@ -118,7 +118,7 @@ public DimensionRawColumnChunk readRawDimensionChunk(FileHolder fileReader,
eachPageLength[i] = dataChunk.getData_chunk_list().get(i).getNumberOfRowsInpage();
}
rawColumnChunk.setDataChunkV3(dataChunk);
rawColumnChunk.setFileHolder(fileReader);
rawColumnChunk.setFileReader(fileReader);
rawColumnChunk.setPagesCount(dataChunk.getPage_length().size());
rawColumnChunk.setMaxValues(maxValueOfEachPage);
rawColumnChunk.setMinValues(minValueOfEachPage);
Expand Down Expand Up @@ -147,7 +147,7 @@ public DimensionRawColumnChunk readRawDimensionChunk(FileHolder fileReader,
* blocklet index of the last dimension column
* @ DimensionRawColumnChunk array
*/
protected DimensionRawColumnChunk[] readRawDimensionChunksInGroup(FileHolder fileReader,
protected DimensionRawColumnChunk[] readRawDimensionChunksInGroup(FileReader fileReader,
int startBlockletColumnIndex, int endBlockletColumnIndex) throws IOException {
// to calculate the length of the data to be read
// column we can subtract the offset of start column offset with
Expand Down Expand Up @@ -182,7 +182,7 @@ protected DimensionRawColumnChunk[] readRawDimensionChunksInGroup(FileHolder fil
eachPageLength[j] = dataChunk.getData_chunk_list().get(j).getNumberOfRowsInpage();
}
dimensionDataChunks[index].setDataChunkV3(dataChunk);
dimensionDataChunks[index].setFileHolder(fileReader);
dimensionDataChunks[index].setFileReader(fileReader);
dimensionDataChunks[index].setPagesCount(dataChunk.getPage_length().size());
dimensionDataChunks[index].setMaxValues(maxValueOfEachPage);
dimensionDataChunks[index].setMinValues(minValueOfEachPage);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import java.util.BitSet;
import java.util.List;

import org.apache.carbondata.core.datastore.FileHolder;
import org.apache.carbondata.core.datastore.FileReader;
import org.apache.carbondata.core.datastore.chunk.impl.MeasureRawColumnChunk;
import org.apache.carbondata.core.datastore.compression.Compressor;
import org.apache.carbondata.core.datastore.compression.CompressorFactory;
Expand Down Expand Up @@ -62,7 +62,7 @@ public AbstractMeasureChunkReaderV2V3Format(final BlockletInfo blockletInfo,
* @return measure column chunks
* @throws IOException
*/
public MeasureRawColumnChunk[] readRawMeasureChunks(FileHolder fileReader,
public MeasureRawColumnChunk[] readRawMeasureChunks(FileReader fileReader,
int[][] columnIndexRange) throws IOException {
// read the column chunk based on block index and add
MeasureRawColumnChunk[] dataChunks =
Expand Down Expand Up @@ -121,7 +121,7 @@ protected BitSet getNullBitSet(
* @return measure raw chunkArray
* @throws IOException
*/
protected abstract MeasureRawColumnChunk[] readRawMeasureChunksInGroup(FileHolder fileReader,
protected abstract MeasureRawColumnChunk[] readRawMeasureChunksInGroup(FileReader fileReader,
int startColumnIndex, int endColumnIndex) throws IOException;

}
Loading

0 comments on commit 0e9130c

Please sign in to comment.