use of com.linkedin.pinot.core.query.selection.SelectionFetcher in project pinot by linkedin.
the class MSelectionOnlyOperator method getNextBlock.
@Override
public Block getNextBlock() {
int numDocsScanned = 0;
ProjectionBlock projectionBlock;
while ((projectionBlock = (ProjectionBlock) _projectionOperator.nextBlock()) != null) {
for (int i = 0; i < _dataSchema.size(); i++) {
_blocks[i] = projectionBlock.getBlock(_dataSchema.getColumnName(i));
}
SelectionFetcher selectionFetcher = new SelectionFetcher(_blocks, _dataSchema);
DocIdSetBlock docIdSetBlock = projectionBlock.getDocIdSetBlock();
int numDocsToFetch = Math.min(docIdSetBlock.getSearchableLength(), _limitDocs - _rowEvents.size());
numDocsScanned += numDocsToFetch;
int[] docIdSet = docIdSetBlock.getDocIdSet();
for (int i = 0; i < numDocsToFetch; i++) {
_rowEvents.add(selectionFetcher.getRow(docIdSet[i]));
}
if (_rowEvents.size() == _limitDocs) {
break;
}
}
// Create execution statistics.
long numEntriesScannedInFilter = _projectionOperator.getExecutionStatistics().getNumEntriesScannedInFilter();
long numEntriesScannedPostFilter = numDocsScanned * _projectionOperator.getNumProjectionColumns();
long numTotalRawDocs = _indexSegment.getSegmentMetadata().getTotalRawDocs();
_executionStatistics = new ExecutionStatistics(numDocsScanned, numEntriesScannedInFilter, numEntriesScannedPostFilter, numTotalRawDocs);
return new IntermediateResultsBlock(_dataSchema, _rowEvents);
}
Aggregations