Search in sources :

Example 6 with EqPredicate

use of com.linkedin.pinot.core.common.predicate.EqPredicate in project pinot by linkedin.

the class ChunkIndexCreationDriverImplTest method test6.

@Test(enabled = false)
public void test6() throws Exception {
    final IndexSegmentImpl segment = (IndexSegmentImpl) Loaders.IndexSegment.load(INDEX_DIR.listFiles()[0], ReadMode.mmap);
    final ImmutableDictionaryReader d = segment.getDictionaryFor("column7");
    final List<String> rhs = new ArrayList<String>();
    rhs.add(d.get(new Random().nextInt(d.length())).toString());
    final Predicate p = new EqPredicate("column7", rhs);
    final DataSource ds = segment.getDataSource("column7", p);
    final Block bl = ds.nextBlock();
    final BlockDocIdSet idSet = bl.getBlockDocIdSet();
    final BlockDocIdIterator it = idSet.iterator();
    int docId = it.next();
    final StringBuilder b = new StringBuilder();
    while (docId != Constants.EOF) {
        b.append(docId + ",");
        docId = it.next();
    }
//    System.out.println(b.toString());
}
Also used : ImmutableDictionaryReader(com.linkedin.pinot.core.segment.index.readers.ImmutableDictionaryReader) ArrayList(java.util.ArrayList) EqPredicate(com.linkedin.pinot.core.common.predicate.EqPredicate) EqPredicate(com.linkedin.pinot.core.common.predicate.EqPredicate) Predicate(com.linkedin.pinot.core.common.Predicate) DataSource(com.linkedin.pinot.core.common.DataSource) BlockDocIdIterator(com.linkedin.pinot.core.common.BlockDocIdIterator) IndexSegmentImpl(com.linkedin.pinot.core.segment.index.IndexSegmentImpl) Random(java.util.Random) BlockDocIdSet(com.linkedin.pinot.core.common.BlockDocIdSet) Block(com.linkedin.pinot.core.common.Block) Test(org.testng.annotations.Test)

Aggregations

EqPredicate (com.linkedin.pinot.core.common.predicate.EqPredicate)6 Block (com.linkedin.pinot.core.common.Block)5 BlockDocIdIterator (com.linkedin.pinot.core.common.BlockDocIdIterator)5 DataSource (com.linkedin.pinot.core.common.DataSource)5 Predicate (com.linkedin.pinot.core.common.Predicate)5 ArrayList (java.util.ArrayList)5 Test (org.testng.annotations.Test)5 BlockDocIdSet (com.linkedin.pinot.core.common.BlockDocIdSet)3 NEqPredicate (com.linkedin.pinot.core.common.predicate.NEqPredicate)3 RangePredicate (com.linkedin.pinot.core.common.predicate.RangePredicate)3 IndexSegmentImpl (com.linkedin.pinot.core.segment.index.IndexSegmentImpl)3 BlockSingleValIterator (com.linkedin.pinot.core.common.BlockSingleValIterator)2 RealtimeSegmentImplTest (com.linkedin.pinot.core.realtime.impl.kafka.RealtimeSegmentImplTest)2 ImmutableDictionaryReader (com.linkedin.pinot.core.segment.index.readers.ImmutableDictionaryReader)2 Random (java.util.Random)2 FilterOperator (com.linkedin.pinot.common.request.FilterOperator)1 InPredicate (com.linkedin.pinot.core.common.predicate.InPredicate)1 NotInPredicate (com.linkedin.pinot.core.common.predicate.NotInPredicate)1 RegexPredicate (com.linkedin.pinot.core.common.predicate.RegexPredicate)1 BitmapBasedFilterOperator (com.linkedin.pinot.core.operator.filter.BitmapBasedFilterOperator)1