Search in sources :

Example 11 with ImmutableDictionaryReader

use of com.linkedin.pinot.core.segment.index.readers.ImmutableDictionaryReader 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

ImmutableDictionaryReader (com.linkedin.pinot.core.segment.index.readers.ImmutableDictionaryReader)11 IndexSegmentImpl (com.linkedin.pinot.core.segment.index.IndexSegmentImpl)6 SegmentMetadataImpl (com.linkedin.pinot.core.segment.index.SegmentMetadataImpl)4 Random (java.util.Random)4 Test (org.testng.annotations.Test)4 ColumnMetadata (com.linkedin.pinot.core.segment.index.ColumnMetadata)3 ColumnIndexContainer (com.linkedin.pinot.core.segment.index.column.ColumnIndexContainer)3 PinotDataBuffer (com.linkedin.pinot.core.segment.memory.PinotDataBuffer)3 File (java.io.File)3 ArrayList (java.util.ArrayList)3 Block (com.linkedin.pinot.core.common.Block)2 BlockDocIdIterator (com.linkedin.pinot.core.common.BlockDocIdIterator)2 BlockDocIdSet (com.linkedin.pinot.core.common.BlockDocIdSet)2 DataSource (com.linkedin.pinot.core.common.DataSource)2 Predicate (com.linkedin.pinot.core.common.Predicate)2 EqPredicate (com.linkedin.pinot.core.common.predicate.EqPredicate)2 BitmapInvertedIndexReader (com.linkedin.pinot.core.segment.index.readers.BitmapInvertedIndexReader)2 IntDictionary (com.linkedin.pinot.core.segment.index.readers.IntDictionary)2 SegmentDirectory (com.linkedin.pinot.core.segment.store.SegmentDirectory)2 HashMap (java.util.HashMap)2