Class BitmapInvertedIndexWriter
- java.lang.Object
-
- org.apache.pinot.segment.local.segment.creator.impl.inv.BitmapInvertedIndexWriter
-
- All Implemented Interfaces:
Closeable,AutoCloseable
public final class BitmapInvertedIndexWriter extends Object implements Closeable
Writer for bitmap inverted index file.Layout for RoaringBitmap inverted index: |-------------------------------------------------------------------------| | Start offset of 1st bitmap | | End offset of 1st bitmap (exclusive) / Start offset of 2nd bitmap | | ... | | End offset of 2nd last bitmap (exclusive) / Start offset of last bitmap | | End offset of last bitmap (exclusive) | |-------------------------------------------------------------------------| | Data for 1st bitmap | | Data for 2nd bitmap | | ... | | Data for last bitmap | |-------------------------------------------------------------------------|
-
-
Constructor Summary
Constructors Constructor Description BitmapInvertedIndexWriter(File outputFile, int numBitmaps)BitmapInvertedIndexWriter(FileChannel fileChannel, int numBitmaps, boolean ownsChannel)Creates a new writer that uses the givenFileChannel.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(byte[] bitmapBytes)voidadd(byte[] bitmapBytes, int length)voidadd(org.roaringbitmap.RoaringBitmap bitmap)voidclose()longgetLastWrittenPosition()
-
-
-
Constructor Detail
-
BitmapInvertedIndexWriter
public BitmapInvertedIndexWriter(File outputFile, int numBitmaps) throws IOException
- Throws:
IOException
-
BitmapInvertedIndexWriter
public BitmapInvertedIndexWriter(FileChannel fileChannel, int numBitmaps, boolean ownsChannel) throws IOException
Creates a new writer that uses the givenFileChannel. It will start to write on the current position of the channel assuming it is the last useful byte in the file. When this object isclosed, the channel is truncated to the last byte written by this writer.- Parameters:
fileChannel- the file channel to be usednumBitmaps- the number of bitmaps that are expected. The actual value cannot be higher than this value. Fewer bitmaps than the given value can be used, but in that case the representation will not be as expected.ownsChannel- whether this writer owns the channel or not. If the channel is owned then it will be closed when this object is closed. Otherwise the owner will have to close it by itself. Even if this writer does not own the channel, it will be truncated when the writer is closed.- Throws:
IOException
-
-
Method Detail
-
add
public void add(org.roaringbitmap.RoaringBitmap bitmap) throws IOException- Throws:
IOException
-
add
public void add(byte[] bitmapBytes) throws IOException- Throws:
IOException
-
add
public void add(byte[] bitmapBytes, int length) throws IOException- Throws:
IOException
-
getLastWrittenPosition
public long getLastWrittenPosition()
-
close
public void close() throws IOException- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-
-