Search in sources :

Example 11 with BaseFilterBlock

use of com.linkedin.pinot.core.operator.blocks.BaseFilterBlock 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

BaseFilterBlock (com.linkedin.pinot.core.operator.blocks.BaseFilterBlock)11 ArrayList (java.util.ArrayList)7 BlockDocIdIterator (com.linkedin.pinot.core.common.BlockDocIdIterator)6 BlockDocIdSet (com.linkedin.pinot.core.common.BlockDocIdSet)6 BaseFilterOperator (com.linkedin.pinot.core.operator.filter.BaseFilterOperator)6 Block (com.linkedin.pinot.core.common.Block)5 Test (org.testng.annotations.Test)5 AndOperator (com.linkedin.pinot.core.operator.filter.AndOperator)4 FilterBlockDocIdSet (com.linkedin.pinot.core.operator.docidsets.FilterBlockDocIdSet)3 Operator (com.linkedin.pinot.core.common.Operator)2 OrOperator (com.linkedin.pinot.core.operator.filter.OrOperator)2 BrokerRequest (com.linkedin.pinot.common.request.BrokerRequest)1 FilterQueryTree (com.linkedin.pinot.common.utils.request.FilterQueryTree)1 BlockId (com.linkedin.pinot.core.common.BlockId)1 BlockMetadata (com.linkedin.pinot.core.common.BlockMetadata)1 BlockValSet (com.linkedin.pinot.core.common.BlockValSet)1 DataSourceMetadata (com.linkedin.pinot.core.common.DataSourceMetadata)1 AndBlock (com.linkedin.pinot.core.operator.blocks.AndBlock)1 BitmapBlock (com.linkedin.pinot.core.operator.blocks.BitmapBlock)1 OrBlock (com.linkedin.pinot.core.operator.blocks.OrBlock)1