Class BaseChunkSVForwardIndexWriter
- java.lang.Object
-
- org.apache.pinot.segment.local.io.writer.impl.BaseChunkSVForwardIndexWriter
-
- All Implemented Interfaces:
Closeable,AutoCloseable
- Direct Known Subclasses:
FixedByteChunkSVForwardIndexWriter,VarByteChunkSVForwardIndexWriter
public abstract class BaseChunkSVForwardIndexWriter extends Object implements Closeable
Base implementation for chunk-based single-value raw (non-dictionary-encoded) forward index writer.
-
-
Field Summary
Fields Modifier and Type Field Description protected ByteBuffer_chunkBufferprotected ChunkCompressor_chunkCompressorprotected int_chunkSizeprotected ByteBuffer_compressedBufferprotected FileChannel_dataFileprotected long_dataOffsetprotected ByteBuffer_headerstatic intCURRENT_VERSIONstatic intDEFAULT_VERSION
-
Constructor Summary
Constructors Modifier Constructor Description protectedBaseChunkSVForwardIndexWriter(File file, ChunkCompressionType compressionType, int totalDocs, int numDocsPerChunk, long chunkSize, int sizeOfEntry, int version, boolean fixed)Constructor for the class.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()static intgetHeaderEntryChunkOffsetSize(int version)protected voidwriteChunk()Helper method to compress and write the current chunk.
-
-
-
Field Detail
-
DEFAULT_VERSION
public static final int DEFAULT_VERSION
- See Also:
- Constant Field Values
-
CURRENT_VERSION
public static final int CURRENT_VERSION
- See Also:
- Constant Field Values
-
_dataFile
protected final FileChannel _dataFile
-
_header
protected ByteBuffer _header
-
_chunkBuffer
protected final ByteBuffer _chunkBuffer
-
_compressedBuffer
protected final ByteBuffer _compressedBuffer
-
_chunkCompressor
protected final ChunkCompressor _chunkCompressor
-
_chunkSize
protected int _chunkSize
-
_dataOffset
protected long _dataOffset
-
-
Constructor Detail
-
BaseChunkSVForwardIndexWriter
protected BaseChunkSVForwardIndexWriter(File file, ChunkCompressionType compressionType, int totalDocs, int numDocsPerChunk, long chunkSize, int sizeOfEntry, int version, boolean fixed) throws IOException
Constructor for the class.- Parameters:
file- Data file to write intocompressionType- Type of compressiontotalDocs- Total docs to writenumDocsPerChunk- Number of docs per data chunkchunkSize- Size of chunksizeOfEntry- Size of entry (in bytes), max size for variable byte implementation.version- version of Filefixed- if the data type is fixed width (required for version validation)- Throws:
IOException- if the file isn't found or can't be mapped
-
-
Method Detail
-
getHeaderEntryChunkOffsetSize
public static int getHeaderEntryChunkOffsetSize(int version)
-
close
public void close() throws IOException- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-
writeChunk
protected void writeChunk()
Helper method to compress and write the current chunk.- Chunk header is of fixed size, so fills out any remaining offsets for partially filled chunks.
- Compresses (if required) and writes the chunk to the data file.
- Updates the header with the current chunks offset.
- Clears up the buffers, so that they can be reused.
-
-