use of org.apache.carbondata.core.scan.result.impl.NonFilterQueryScannedResult in project carbondata by apache.
the class AbstractBlockletScanner method scanBlocklet.
@Override
public AbstractScannedResult scanBlocklet(BlocksChunkHolder blocksChunkHolder) throws IOException, FilterUnsupportedException {
long startTime = System.currentTimeMillis();
AbstractScannedResult scannedResult = new NonFilterQueryScannedResult(blockExecutionInfo);
QueryStatistic totalBlockletStatistic = queryStatisticsModel.getStatisticsTypeAndObjMap().get(QueryStatisticsConstants.TOTAL_BLOCKLET_NUM);
totalBlockletStatistic.addCountStatistic(QueryStatisticsConstants.TOTAL_BLOCKLET_NUM, totalBlockletStatistic.getCount() + 1);
QueryStatistic validScannedBlockletStatistic = queryStatisticsModel.getStatisticsTypeAndObjMap().get(QueryStatisticsConstants.VALID_SCAN_BLOCKLET_NUM);
validScannedBlockletStatistic.addCountStatistic(QueryStatisticsConstants.VALID_SCAN_BLOCKLET_NUM, validScannedBlockletStatistic.getCount() + 1);
// adding statistics for valid number of pages
QueryStatistic validPages = queryStatisticsModel.getStatisticsTypeAndObjMap().get(QueryStatisticsConstants.VALID_PAGE_SCANNED);
validPages.addCountStatistic(QueryStatisticsConstants.VALID_PAGE_SCANNED, validPages.getCount() + blocksChunkHolder.getDataBlock().numberOfPages());
// adding statistics for number of pages
QueryStatistic totalPagesScanned = queryStatisticsModel.getStatisticsTypeAndObjMap().get(QueryStatisticsConstants.TOTAL_PAGE_SCANNED);
totalPagesScanned.addCountStatistic(QueryStatisticsConstants.TOTAL_PAGE_SCANNED, totalPagesScanned.getCount() + blocksChunkHolder.getDataBlock().numberOfPages());
scannedResult.setBlockletId(blockExecutionInfo.getBlockId() + CarbonCommonConstants.FILE_SEPARATOR + blocksChunkHolder.getDataBlock().nodeNumber());
DimensionRawColumnChunk[] dimensionRawColumnChunks = blocksChunkHolder.getDimensionRawDataChunk();
DimensionColumnDataChunk[][] dimensionColumnDataChunks = new DimensionColumnDataChunk[dimensionRawColumnChunks.length][];
for (int i = 0; i < dimensionRawColumnChunks.length; i++) {
if (dimensionRawColumnChunks[i] != null) {
dimensionColumnDataChunks[i] = dimensionRawColumnChunks[i].convertToDimColDataChunks();
}
}
scannedResult.setDimensionChunks(dimensionColumnDataChunks);
MeasureRawColumnChunk[] measureRawColumnChunks = blocksChunkHolder.getMeasureRawDataChunk();
MeasureColumnDataChunk[][] measureColumnDataChunks = new MeasureColumnDataChunk[measureRawColumnChunks.length][];
for (int i = 0; i < measureRawColumnChunks.length; i++) {
if (measureRawColumnChunks[i] != null) {
measureColumnDataChunks[i] = measureRawColumnChunks[i].convertToMeasureColDataChunks();
}
}
scannedResult.setMeasureChunks(measureColumnDataChunks);
int[] numberOfRows = new int[] { blocksChunkHolder.getDataBlock().nodeSize() };
if (blockExecutionInfo.getAllSelectedDimensionBlocksIndexes().length > 0) {
for (int i = 0; i < dimensionRawColumnChunks.length; i++) {
if (dimensionRawColumnChunks[i] != null) {
numberOfRows = dimensionRawColumnChunks[i].getRowCount();
break;
}
}
} else if (blockExecutionInfo.getAllSelectedMeasureBlocksIndexes().length > 0) {
for (int i = 0; i < measureRawColumnChunks.length; i++) {
if (measureRawColumnChunks[i] != null) {
numberOfRows = measureRawColumnChunks[i].getRowCount();
break;
}
}
}
scannedResult.setNumberOfRows(numberOfRows);
// loading delete data cache in blockexecutioninfo instance
DeleteDeltaCacheLoaderIntf deleteCacheLoader = new BlockletDeleteDeltaCacheLoader(scannedResult.getBlockletId(), blocksChunkHolder.getDataBlock(), blockExecutionInfo.getAbsoluteTableIdentifier());
deleteCacheLoader.loadDeleteDeltaFileDataToCache();
scannedResult.setBlockletDeleteDeltaCache(blocksChunkHolder.getDataBlock().getDeleteDeltaDataCache());
scannedResult.setRawColumnChunks(dimensionRawColumnChunks);
// adding statistics for carbon scan time
QueryStatistic scanTime = queryStatisticsModel.getStatisticsTypeAndObjMap().get(QueryStatisticsConstants.SCAN_BLOCKlET_TIME);
scanTime.addCountStatistic(QueryStatisticsConstants.SCAN_BLOCKlET_TIME, scanTime.getCount() + (System.currentTimeMillis() - startTime));
return scannedResult;
}
use of org.apache.carbondata.core.scan.result.impl.NonFilterQueryScannedResult in project carbondata by apache.
the class AbstractBlockletScanner method createEmptyResult.
@Override
public AbstractScannedResult createEmptyResult() {
if (emptyResult == null) {
emptyResult = new NonFilterQueryScannedResult(blockExecutionInfo);
emptyResult.setNumberOfRows(new int[0]);
emptyResult.setIndexes(new int[0][]);
}
return emptyResult;
}
use of org.apache.carbondata.core.scan.result.impl.NonFilterQueryScannedResult in project carbondata by apache.
the class BlockletFullScanner method createEmptyResult.
BlockletScannedResult createEmptyResult() {
if (emptyResult == null) {
emptyResult = new NonFilterQueryScannedResult(blockExecutionInfo);
emptyResult.setPageFilteredRowCount(new int[0]);
emptyResult.setPageFilteredRowId(new int[0][]);
}
return emptyResult;
}
use of org.apache.carbondata.core.scan.result.impl.NonFilterQueryScannedResult in project carbondata by apache.
the class BlockletFullScanner method scanBlocklet.
@Override
public BlockletScannedResult scanBlocklet(RawBlockletColumnChunks rawBlockletColumnChunks) throws IOException, FilterUnsupportedException {
long startTime = System.currentTimeMillis();
BlockletScannedResult scannedResult = new NonFilterQueryScannedResult(blockExecutionInfo);
QueryStatistic totalBlockletStatistic = queryStatisticsModel.getStatisticsTypeAndObjMap().get(QueryStatisticsConstants.TOTAL_BLOCKLET_NUM);
totalBlockletStatistic.addCountStatistic(QueryStatisticsConstants.TOTAL_BLOCKLET_NUM, totalBlockletStatistic.getCount() + 1);
QueryStatistic validScannedBlockletStatistic = queryStatisticsModel.getStatisticsTypeAndObjMap().get(QueryStatisticsConstants.VALID_SCAN_BLOCKLET_NUM);
validScannedBlockletStatistic.addCountStatistic(QueryStatisticsConstants.VALID_SCAN_BLOCKLET_NUM, validScannedBlockletStatistic.getCount() + 1);
// adding statistics for valid number of pages
QueryStatistic validPages = queryStatisticsModel.getStatisticsTypeAndObjMap().get(QueryStatisticsConstants.VALID_PAGE_SCANNED);
validPages.addCountStatistic(QueryStatisticsConstants.VALID_PAGE_SCANNED, validPages.getCount() + rawBlockletColumnChunks.getDataBlock().numberOfPages());
// adding statistics for number of pages
QueryStatistic totalPagesScanned = queryStatisticsModel.getStatisticsTypeAndObjMap().get(QueryStatisticsConstants.TOTAL_PAGE_SCANNED);
totalPagesScanned.addCountStatistic(QueryStatisticsConstants.TOTAL_PAGE_SCANNED, totalPagesScanned.getCount() + rawBlockletColumnChunks.getDataBlock().numberOfPages());
scannedResult.setBlockletId(blockExecutionInfo.getBlockIdString() + CarbonCommonConstants.FILE_SEPARATOR + rawBlockletColumnChunks.getDataBlock().blockletIndex());
if (!blockExecutionInfo.isPrefetchBlocklet()) {
readBlocklet(rawBlockletColumnChunks);
}
DimensionRawColumnChunk[] dimensionRawColumnChunks = rawBlockletColumnChunks.getDimensionRawColumnChunks();
DimensionColumnPage[][] dimensionColumnDataChunks = new DimensionColumnPage[dimensionRawColumnChunks.length][rawBlockletColumnChunks.getDataBlock().numberOfPages()];
MeasureRawColumnChunk[] measureRawColumnChunks = rawBlockletColumnChunks.getMeasureRawColumnChunks();
ColumnPage[][] measureColumnPages = new ColumnPage[measureRawColumnChunks.length][rawBlockletColumnChunks.getDataBlock().numberOfPages()];
scannedResult.setDimensionColumnPages(dimensionColumnDataChunks);
scannedResult.setMeasureColumnPages(measureColumnPages);
scannedResult.setDimRawColumnChunks(dimensionRawColumnChunks);
scannedResult.setMsrRawColumnChunks(measureRawColumnChunks);
if (blockExecutionInfo.isPrefetchBlocklet()) {
for (int i = 0; i < dimensionRawColumnChunks.length; i++) {
if (dimensionRawColumnChunks[i] != null) {
dimensionColumnDataChunks[i] = dimensionRawColumnChunks[i].decodeAllColumnPages();
}
}
for (int i = 0; i < measureRawColumnChunks.length; i++) {
if (measureRawColumnChunks[i] != null) {
measureColumnPages[i] = measureRawColumnChunks[i].decodeAllColumnPages();
}
}
}
int[] numberOfRows = null;
if (blockExecutionInfo.getAllSelectedDimensionColumnIndexRange().length > 0) {
for (int i = 0; i < dimensionRawColumnChunks.length; i++) {
if (dimensionRawColumnChunks[i] != null) {
numberOfRows = dimensionRawColumnChunks[i].getRowCount();
break;
}
}
} else if (blockExecutionInfo.getAllSelectedMeasureIndexRange().length > 0) {
for (int i = 0; i < measureRawColumnChunks.length; i++) {
if (measureRawColumnChunks[i] != null) {
numberOfRows = measureRawColumnChunks[i].getRowCount();
break;
}
}
}
// count(*) case there would not be any dimensions are measures selected.
if (numberOfRows == null) {
numberOfRows = new int[rawBlockletColumnChunks.getDataBlock().numberOfPages()];
for (int i = 0; i < numberOfRows.length; i++) {
numberOfRows[i] = CarbonV3DataFormatConstants.NUMBER_OF_ROWS_PER_BLOCKLET_COLUMN_PAGE_DEFAULT;
}
int lastPageSize = rawBlockletColumnChunks.getDataBlock().numRows() % CarbonV3DataFormatConstants.NUMBER_OF_ROWS_PER_BLOCKLET_COLUMN_PAGE_DEFAULT;
;
if (lastPageSize > 0) {
numberOfRows[numberOfRows.length - 1] = lastPageSize;
}
}
scannedResult.setPageFilteredRowCount(numberOfRows);
if (!blockExecutionInfo.isPrefetchBlocklet()) {
scannedResult.fillDataChunks();
}
// adding statistics for carbon scan time
QueryStatistic scanTime = queryStatisticsModel.getStatisticsTypeAndObjMap().get(QueryStatisticsConstants.SCAN_BLOCKlET_TIME);
scanTime.addCountStatistic(QueryStatisticsConstants.SCAN_BLOCKlET_TIME, scanTime.getCount() + (System.currentTimeMillis() - startTime));
return scannedResult;
}
Aggregations