Class VarByteChunkForwardIndexWriter
- java.lang.Object
-
- org.apache.pinot.segment.local.io.writer.impl.BaseChunkForwardIndexWriter
-
- org.apache.pinot.segment.local.io.writer.impl.VarByteChunkForwardIndexWriter
-
- All Implemented Interfaces:
Closeable,AutoCloseable,VarByteChunkWriter
@NotThreadSafe public class VarByteChunkForwardIndexWriter extends BaseChunkForwardIndexWriter implements VarByteChunkWriter
Chunk-based raw (non-dictionary-encoded) forward index writer where each chunk contains fixed number of docs, and the entries are variable length.The layout of each chunk is as follows:
- Header Section: start offsets (stored as int) of the entry within the data section. For partial chunks, offset values are 0 for missing entries.
- Data Section
-
-
Field Summary
Fields Modifier and Type Field Description static intCHUNK_HEADER_ENTRY_ROW_OFFSET_SIZE-
Fields inherited from class org.apache.pinot.segment.local.io.writer.impl.BaseChunkForwardIndexWriter
_chunkBuffer, _chunkCompressor, _chunkSize, _compressedBuffer, _dataFile, _dataOffset, _header
-
-
Constructor Summary
Constructors Constructor Description VarByteChunkForwardIndexWriter(File file, ChunkCompressionType compressionType, int totalDocs, int numDocsPerChunk, int lengthOfLongestEntry, int writerVersion)Constructor for the class.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidputBigDecimal(BigDecimal value)voidputBytes(byte[] value)voidputBytesMV(byte[][] values)voidputString(String value)voidputStringMV(String[] values)protected voidwriteChunk()Helper method to compress and write the current chunk.-
Methods inherited from class org.apache.pinot.segment.local.io.writer.impl.BaseChunkForwardIndexWriter
close
-
-
-
-
Field Detail
-
CHUNK_HEADER_ENTRY_ROW_OFFSET_SIZE
public static final int CHUNK_HEADER_ENTRY_ROW_OFFSET_SIZE
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
VarByteChunkForwardIndexWriter
public VarByteChunkForwardIndexWriter(File file, ChunkCompressionType compressionType, int totalDocs, int numDocsPerChunk, int lengthOfLongestEntry, int writerVersion) throws IOException
Constructor for the class.- Parameters:
file- File to write to.compressionType- Type of compression to use.totalDocs- Total number of docs to write.numDocsPerChunk- Number of documents per chunk.lengthOfLongestEntry- Length of longest entry (in bytes)writerVersion- writer format version- Throws:
FileNotFoundException- ThrowsFileNotFoundExceptionif the specified file is not found.IOException
-
-
Method Detail
-
putBigDecimal
public void putBigDecimal(BigDecimal value)
- Specified by:
putBigDecimalin interfaceVarByteChunkWriter
-
putString
public void putString(String value)
- Specified by:
putStringin interfaceVarByteChunkWriter
-
putBytes
public void putBytes(byte[] value)
- Specified by:
putBytesin interfaceVarByteChunkWriter
-
putStringMV
public void putStringMV(String[] values)
- Specified by:
putStringMVin interfaceVarByteChunkWriter
-
putBytesMV
public void putBytesMV(byte[][] values)
- Specified by:
putBytesMVin interfaceVarByteChunkWriter
-
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 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.
- Overrides:
writeChunkin classBaseChunkForwardIndexWriter
-
-