Search in sources :

Example 1 with BitmapBlock

use of com.linkedin.pinot.core.operator.blocks.BitmapBlock in project pinot by linkedin.

the class BitmapBasedFilterOperator method nextFilterBlock.

@Override
public BaseFilterBlock nextFilterBlock(BlockId BlockId) {
    InvertedIndexReader invertedIndex = dataSource.getInvertedIndex();
    Block dataSourceBlock = dataSource.nextBlock();
    int[] dictionaryIds;
    boolean exclusion = false;
    switch(predicate.getType()) {
        case EQ:
        case IN:
        case RANGE:
            dictionaryIds = predicateEvaluator.getMatchingDictionaryIds();
            break;
        case NEQ:
        case NOT_IN:
            exclusion = true;
            dictionaryIds = predicateEvaluator.getNonMatchingDictionaryIds();
            break;
        case REGEX:
        default:
            throw new UnsupportedOperationException("Regex is not supported");
    }
    ImmutableRoaringBitmap[] bitmaps = new ImmutableRoaringBitmap[dictionaryIds.length];
    for (int i = 0; i < dictionaryIds.length; i++) {
        bitmaps[i] = invertedIndex.getImmutable(dictionaryIds[i]);
    }
    bitmapBlock = new BitmapBlock(dataSource.getOperatorName(), dataSourceBlock.getMetadata(), startDocId, endDocId, bitmaps, exclusion);
    return bitmapBlock;
}
Also used : InvertedIndexReader(com.linkedin.pinot.core.segment.index.readers.InvertedIndexReader) ImmutableRoaringBitmap(org.roaringbitmap.buffer.ImmutableRoaringBitmap) Block(com.linkedin.pinot.core.common.Block) BitmapBlock(com.linkedin.pinot.core.operator.blocks.BitmapBlock) BaseFilterBlock(com.linkedin.pinot.core.operator.blocks.BaseFilterBlock) BitmapBlock(com.linkedin.pinot.core.operator.blocks.BitmapBlock)

Aggregations

Block (com.linkedin.pinot.core.common.Block)1 BaseFilterBlock (com.linkedin.pinot.core.operator.blocks.BaseFilterBlock)1 BitmapBlock (com.linkedin.pinot.core.operator.blocks.BitmapBlock)1 InvertedIndexReader (com.linkedin.pinot.core.segment.index.readers.InvertedIndexReader)1 ImmutableRoaringBitmap (org.roaringbitmap.buffer.ImmutableRoaringBitmap)1