Skip to content

Commit

Permalink
Merge 2ba8dde into ed117f7
Browse files Browse the repository at this point in the history
  • Loading branch information
vikramahuja1001 committed Jul 30, 2019
2 parents ed117f7 + 2ba8dde commit a2d34d2
Showing 1 changed file with 22 additions and 12 deletions.
Expand Up @@ -232,12 +232,8 @@ private BlockletScannedResult executeFilter(RawBlockletColumnChunks rawBlockletC
}
}

long dimensionReadTime = System.currentTimeMillis();
dimensionReadTime = System.currentTimeMillis() - dimensionReadTime;

FileReader fileReader = rawBlockletColumnChunks.getFileReader();


DimensionRawColumnChunk[] dimensionRawColumnChunks =
new DimensionRawColumnChunk[blockExecutionInfo.getTotalNumberDimensionToRead()];
int numDimensionChunks = dimensionRawColumnChunks.length;
Expand All @@ -246,20 +242,26 @@ private BlockletScannedResult executeFilter(RawBlockletColumnChunks rawBlockletC
dimensionRawColumnChunks[chunkIndex] =
rawBlockletColumnChunks.getDimensionRawColumnChunks()[chunkIndex];
}
//dimensionReadTime is the time required to read the data from dimension array
long totalReadTime = System.currentTimeMillis();
int[][] allSelectedDimensionColumnIndexRange =
blockExecutionInfo.getAllSelectedDimensionColumnIndexRange();
DimensionRawColumnChunk[] projectionListDimensionChunk = rawBlockletColumnChunks.getDataBlock()
.readDimensionChunks(fileReader, allSelectedDimensionColumnIndexRange);
totalReadTime = System.currentTimeMillis() - totalReadTime;

for (int[] columnIndexRange : allSelectedDimensionColumnIndexRange) {
System.arraycopy(projectionListDimensionChunk, columnIndexRange[0],
dimensionRawColumnChunks, columnIndexRange[0],
columnIndexRange[1] + 1 - columnIndexRange[0]);
}

/*
* in case projection if the projected dimension are not loaded in the dimensionColumnDataChunk
* then loading them
/**
* Below code is to read the dimension which is not read as part of filter or projection
* for example in case of or filter if first filter matches all the rows then it will not read
* second filter column and if it is present as part of projection, so needs to be read
*/
long filterDimensionReadTime = System.currentTimeMillis();
int[] projectionListDimensionIndexes = blockExecutionInfo.getProjectionListDimensionIndexes();
for (int projectionListDimensionIndex : projectionListDimensionIndexes) {
if (null == dimensionRawColumnChunks[projectionListDimensionIndex]) {
Expand All @@ -268,6 +270,7 @@ private BlockletScannedResult executeFilter(RawBlockletColumnChunks rawBlockletC
fileReader, projectionListDimensionIndex);
}
}
totalReadTime += System.currentTimeMillis() - filterDimensionReadTime;

DimensionColumnPage[][] dimensionColumnPages =
new DimensionColumnPage[numDimensionChunks][numPages];
Expand All @@ -283,25 +286,32 @@ private BlockletScannedResult executeFilter(RawBlockletColumnChunks rawBlockletC
}
}

long measureReadTime = System.currentTimeMillis();
int[][] allSelectedMeasureColumnIndexRange =
blockExecutionInfo.getAllSelectedMeasureIndexRange();
MeasureRawColumnChunk[] projectionListMeasureChunk = rawBlockletColumnChunks.getDataBlock()
.readMeasureChunks(fileReader, allSelectedMeasureColumnIndexRange);
measureReadTime = System.currentTimeMillis() - measureReadTime;

for (int[] columnIndexRange : allSelectedMeasureColumnIndexRange) {
System.arraycopy(projectionListMeasureChunk, columnIndexRange[0], measureRawColumnChunks,
columnIndexRange[0], columnIndexRange[1] + 1 - columnIndexRange[0]);
}
/*
* in case projection if the projected measure are not loaded in the ColumnPage
* then loading them
/**
* Below code is to read the measure which is not read as part of filter or projection
* for example in case of or filter if first filter matches all the rows then it will not read
* second filter column and if it is present as part of projection, so needs to be read
*/
long filterMeasureReadTime = System.currentTimeMillis();
int[] projectionListMeasureIndexes = blockExecutionInfo.getProjectionListMeasureIndexes();
for (int projectionListMeasureIndex : projectionListMeasureIndexes) {
if (null == measureRawColumnChunks[projectionListMeasureIndex]) {
measureRawColumnChunks[projectionListMeasureIndex] = rawBlockletColumnChunks.getDataBlock()
.readMeasureChunk(fileReader, projectionListMeasureIndex);
}
}
measureReadTime += System.currentTimeMillis() - filterMeasureReadTime;
totalReadTime += measureReadTime;
ColumnPage[][] measureColumnPages = new ColumnPage[numMeasureChunks][numPages];
scannedResult.setDimensionColumnPages(dimensionColumnPages);
scannedResult.setPageFilteredRowId(pageFilteredRowId);
Expand All @@ -314,11 +324,11 @@ private BlockletScannedResult executeFilter(RawBlockletColumnChunks rawBlockletC
QueryStatistic scanTime = queryStatisticsModel.getStatisticsTypeAndObjMap()
.get(QueryStatisticsConstants.SCAN_BLOCKlET_TIME);
scanTime.addCountStatistic(QueryStatisticsConstants.SCAN_BLOCKlET_TIME,
scanTime.getCount() + (System.currentTimeMillis() - startTime - dimensionReadTime));
scanTime.getCount() + (System.currentTimeMillis() - startTime - totalReadTime));
QueryStatistic readTime = queryStatisticsModel.getStatisticsTypeAndObjMap()
.get(QueryStatisticsConstants.READ_BLOCKlET_TIME);
readTime.addCountStatistic(QueryStatisticsConstants.READ_BLOCKlET_TIME,
readTime.getCount() + dimensionReadTime);
readTime.getCount() + totalReadTime);
return scannedResult;
}

Expand Down

0 comments on commit a2d34d2

Please sign in to comment.