Class OffHeapBitmapInvertedIndexCreator
- java.lang.Object
-
- org.apache.pinot.segment.local.segment.creator.impl.inv.OffHeapBitmapInvertedIndexCreator
-
- All Implemented Interfaces:
Closeable,AutoCloseable,DictionaryBasedInvertedIndexCreator,InvertedIndexCreator
public final class OffHeapBitmapInvertedIndexCreator extends Object implements DictionaryBasedInvertedIndexCreator
Implementation ofDictionaryBasedInvertedIndexCreatorthat uses off-heap memory.We use 2 passes to create the inverted index.
- In the first pass (adding values phase), when add() method is called, store the dictIds into the forward index value buffer (for multi-valued column also store number of values for each docId into forward index length buffer). We also compute the inverted index length for each dictId while adding values.
-
In the second pass (processing values phase), when seal() method is called, all the dictIds should already been
added. We first reorder the values into the inverted index buffers by going over the dictIds in forward index
value buffer (for multi-valued column we also need forward index length buffer to get the docId for each dictId).
Once we have the inverted index buffers, we simply go over them and create the bitmap for each dictId and serialize them into a file.
Based on the number of values we need to store, we use direct memory or MMap file to allocate the buffer.
-
-
Constructor Summary
Constructors Constructor Description OffHeapBitmapInvertedIndexCreator(File indexDir, FieldSpec fieldSpec, int cardinality, int numDocs, int numValues)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(int dictId)voidadd(int[] dictIds, int length)voidclose()voidseal()
-
-
-
Constructor Detail
-
OffHeapBitmapInvertedIndexCreator
public OffHeapBitmapInvertedIndexCreator(File indexDir, FieldSpec fieldSpec, int cardinality, int numDocs, int numValues) throws IOException
- Throws:
IOException
-
-
Method Detail
-
add
public void add(int dictId)
- Specified by:
addin interfaceDictionaryBasedInvertedIndexCreator
-
add
public void add(int[] dictIds, int length)- Specified by:
addin interfaceDictionaryBasedInvertedIndexCreator
-
seal
public void seal() throws IOException- Specified by:
sealin interfaceInvertedIndexCreator- Throws:
IOException
-
close
public void close() throws IOException- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-
-