Class VarByteChunkSVForwardIndexWriter
- java.lang.Object
-
- org.apache.pinot.segment.local.io.writer.impl.BaseChunkSVForwardIndexWriter
-
- org.apache.pinot.segment.local.io.writer.impl.VarByteChunkSVForwardIndexWriter
-
- All Implemented Interfaces:
Closeable,AutoCloseable,VarByteChunkWriter
@NotThreadSafe public class VarByteChunkSVForwardIndexWriter extends BaseChunkSVForwardIndexWriter implements VarByteChunkWriter
Class to write out variable length bytes into a single column. The layout of the file is as follows:Header Section:
- Integer: File format version.
- Integer: Total number of chunks.
- Integer: Number of docs per chunk.
- Integer: Length of longest entry (in bytes).
- Integer: Total number of docs (version 2 onwards).
- Integer: Compression type enum value (version 2 onwards).
- Integer: Start offset of data header (version 2 onwards).
- Integer array: Integer offsets for all chunks in the data (upto version 2), Long array: Long offsets for all chunks in the data (version 3 onwards)
Individual Chunks:
- Integer offsets to start position of rows: For partial chunks, offset values are 0 for missing rows.
- Data bytes.
-
-
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.BaseChunkSVForwardIndexWriter
_chunkBuffer, _chunkCompressor, _chunkSize, _compressedBuffer, _dataFile, _dataOffset, _header, CURRENT_VERSION, DEFAULT_VERSION
-
-
Constructor Summary
Constructors Constructor Description VarByteChunkSVForwardIndexWriter(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)voidputByteArrays(byte[][] values)voidputBytes(byte[] value)voidputString(String value)voidputStrings(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.BaseChunkSVForwardIndexWriter
close, getHeaderEntryChunkOffsetSize
-
-
-
-
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
-
VarByteChunkSVForwardIndexWriter
public VarByteChunkSVForwardIndexWriter(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
-
putStrings
public void putStrings(String[] values)
-
putByteArrays
public void putByteArrays(byte[][] values)
-
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 classBaseChunkSVForwardIndexWriter
-
-