Search in sources :

Example 11 with BaseFilterOperator

use of com.linkedin.pinot.core.operator.filter.BaseFilterOperator in project pinot by linkedin.

the class OrOperatorTest method testIntersectionForThreeLists.

@Test
public void testIntersectionForThreeLists() {
    int[] list1 = new int[] { 2, 3, 6, 10, 15, 16, 28 };
    int[] list2 = new int[] { 3, 6, 8, 20, 28 };
    int[] list3 = new int[] { 1, 2, 3, 6, 30 };
    List<BaseFilterOperator> operators = new ArrayList<>();
    operators.add(makeFilterOperator(list1));
    operators.add(makeFilterOperator(list2));
    operators.add(makeFilterOperator(list3));
    final OrOperator orOperator = new OrOperator(operators);
    orOperator.open();
    Block block;
    TreeSet<Integer> set = new TreeSet<Integer>();
    set.addAll(Lists.newArrayList(ArrayUtils.toObject(list1)));
    set.addAll(Lists.newArrayList(ArrayUtils.toObject(list2)));
    set.addAll(Lists.newArrayList(ArrayUtils.toObject(list3)));
    Iterator<Integer> expectedIterator = set.iterator();
    while ((block = orOperator.nextBlock()) != null) {
        final BlockDocIdSet blockDocIdSet = block.getBlockDocIdSet();
        final BlockDocIdIterator iterator = blockDocIdSet.iterator();
        int docId;
        while ((docId = iterator.next()) != Constants.EOF) {
            Assert.assertEquals(expectedIterator.next().intValue(), docId);
        }
    }
    orOperator.close();
}
Also used : OrOperator(com.linkedin.pinot.core.operator.filter.OrOperator) ArrayList(java.util.ArrayList) BlockDocIdIterator(com.linkedin.pinot.core.common.BlockDocIdIterator) BaseFilterOperator(com.linkedin.pinot.core.operator.filter.BaseFilterOperator) TreeSet(java.util.TreeSet) BlockDocIdSet(com.linkedin.pinot.core.common.BlockDocIdSet) Block(com.linkedin.pinot.core.common.Block) BaseFilterBlock(com.linkedin.pinot.core.operator.blocks.BaseFilterBlock) Test(org.testng.annotations.Test)

Example 12 with BaseFilterOperator

use of com.linkedin.pinot.core.operator.filter.BaseFilterOperator in project pinot by linkedin.

the class RawIndexBenchmark method profileLookups.

/**
   * Profiles the lookup time for a given column, for the given docIds.
   *
   * @param segment Segment to profile
   * @param column Column to profile
   * @param docIds DocIds to lookup on the column
   * @return Time take in millis for the lookups
   */
private long profileLookups(IndexSegment segment, String column, int[] docIds) {
    BaseFilterOperator filterOperator = new TestFilterOperator(docIds);
    BReusableFilteredDocIdSetOperator docIdSetOperator = new BReusableFilteredDocIdSetOperator(filterOperator, docIds.length, DocIdSetPlanNode.MAX_DOC_PER_CALL);
    ProjectionBlock projectionBlock;
    MProjectionOperator projectionOperator = new MProjectionOperator(buildDataSourceMap(segment), docIdSetOperator);
    long start = System.currentTimeMillis();
    while ((projectionBlock = (ProjectionBlock) projectionOperator.nextBlock()) != null) {
        ProjectionBlockValSet blockValueSet = (ProjectionBlockValSet) projectionBlock.getBlockValueSet(column);
        blockValueSet.getDoubleValuesSV();
    }
    return (System.currentTimeMillis() - start);
}
Also used : MProjectionOperator(com.linkedin.pinot.core.operator.MProjectionOperator) ProjectionBlock(com.linkedin.pinot.core.operator.blocks.ProjectionBlock) BaseFilterOperator(com.linkedin.pinot.core.operator.filter.BaseFilterOperator) BReusableFilteredDocIdSetOperator(com.linkedin.pinot.core.operator.BReusableFilteredDocIdSetOperator) ProjectionBlockValSet(com.linkedin.pinot.core.operator.docvalsets.ProjectionBlockValSet)

Aggregations

BaseFilterOperator (com.linkedin.pinot.core.operator.filter.BaseFilterOperator)12 BlockDocIdIterator (com.linkedin.pinot.core.common.BlockDocIdIterator)8 BlockDocIdSet (com.linkedin.pinot.core.common.BlockDocIdSet)8 BaseFilterBlock (com.linkedin.pinot.core.operator.blocks.BaseFilterBlock)8 ArrayList (java.util.ArrayList)8 Test (org.testng.annotations.Test)7 AndOperator (com.linkedin.pinot.core.operator.filter.AndOperator)6 OrOperator (com.linkedin.pinot.core.operator.filter.OrOperator)6 EmptyFilterOperator (com.linkedin.pinot.core.operator.filter.EmptyFilterOperator)3 TreeSet (java.util.TreeSet)3 FilterOperator (com.linkedin.pinot.common.request.FilterOperator)2 FilterQueryTree (com.linkedin.pinot.common.utils.request.FilterQueryTree)2 Block (com.linkedin.pinot.core.common.Block)2 BitmapBasedFilterOperator (com.linkedin.pinot.core.operator.filter.BitmapBasedFilterOperator)2 MatchEntireSegmentOperator (com.linkedin.pinot.core.operator.filter.MatchEntireSegmentOperator)2 ScanBasedFilterOperator (com.linkedin.pinot.core.operator.filter.ScanBasedFilterOperator)2 SortedInvertedIndexBasedFilterOperator (com.linkedin.pinot.core.operator.filter.SortedInvertedIndexBasedFilterOperator)2 VisibleForTesting (com.google.common.annotations.VisibleForTesting)1 BrokerRequest (com.linkedin.pinot.common.request.BrokerRequest)1 DataSource (com.linkedin.pinot.core.common.DataSource)1