Class BaseChunkForwardIndexReader
- java.lang.Object
-
- org.apache.pinot.segment.local.segment.index.readers.forward.BaseChunkForwardIndexReader
-
- All Implemented Interfaces:
Closeable,AutoCloseable,ForwardIndexReader<ChunkReaderContext>
- Direct Known Subclasses:
FixedByteChunkMVForwardIndexReader,FixedByteChunkSVForwardIndexReader,FixedBytePower2ChunkSVForwardIndexReader,VarByteChunkMVForwardIndexReader,VarByteChunkSVForwardIndexReader
public abstract class BaseChunkForwardIndexReader extends Object implements ForwardIndexReader<ChunkReaderContext>
Base implementation for chunk-based raw (non-dictionary-encoded) forward index reader.
-
-
Field Summary
Fields Modifier and Type Field Description protected ChunkDecompressor_chunkDecompressorprotected PinotDataBuffer_dataBufferprotected PinotDataBuffer_dataHeaderprotected int_headerEntryChunkOffsetSizeprotected boolean_isCompressedprotected boolean_isSingleValueprotected int_lengthOfLongestEntryprotected int_numChunksprotected int_numDocsPerChunkprotected PinotDataBuffer_rawDataprotected FieldSpec.DataType_storedType
-
Constructor Summary
Constructors Constructor Description BaseChunkForwardIndexReader(PinotDataBuffer dataBuffer, FieldSpec.DataType storedType, boolean isSingleValue)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()protected ByteBufferdecompressChunk(int chunkId, ChunkReaderContext context)protected ByteBuffergetChunkBuffer(int docId, ChunkReaderContext context)Helper method to return the chunk buffer that contains the value at the given document id.protected longgetChunkPosition(int chunkId)Helper method to get the offset of the chunk in the data.FieldSpec.DataTypegetStoredType()booleanisDictionaryEncoded()booleanisSingleValue()voidreadValuesSV(int[] docIds, int length, double[] values, ChunkReaderContext context)voidreadValuesSV(int[] docIds, int length, float[] values, ChunkReaderContext context)voidreadValuesSV(int[] docIds, int length, int[] values, ChunkReaderContext context)voidreadValuesSV(int[] docIds, int length, long[] values, ChunkReaderContext context)-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.pinot.segment.spi.index.reader.ForwardIndexReader
createContext, getBigDecimal, getBytes, getBytesMV, getBytesMV, getDictId, getDictIdMV, getDictIdMV, getDouble, getDoubleMV, getDoubleMV, getFloat, getFloatMV, getFloatMV, getInt, getIntMV, getIntMV, getLong, getLongMV, getLongMV, getNumValuesMV, getString, getStringMV, getStringMV, readDictIds, readValuesMV, readValuesMV, readValuesMV, readValuesMV, readValuesMV, readValuesSV
-
-
-
-
Field Detail
-
_dataBuffer
protected final PinotDataBuffer _dataBuffer
-
_storedType
protected final FieldSpec.DataType _storedType
-
_numChunks
protected final int _numChunks
-
_numDocsPerChunk
protected final int _numDocsPerChunk
-
_lengthOfLongestEntry
protected final int _lengthOfLongestEntry
-
_isCompressed
protected final boolean _isCompressed
-
_chunkDecompressor
protected final ChunkDecompressor _chunkDecompressor
-
_dataHeader
protected final PinotDataBuffer _dataHeader
-
_headerEntryChunkOffsetSize
protected final int _headerEntryChunkOffsetSize
-
_rawData
protected final PinotDataBuffer _rawData
-
_isSingleValue
protected final boolean _isSingleValue
-
-
Constructor Detail
-
BaseChunkForwardIndexReader
public BaseChunkForwardIndexReader(PinotDataBuffer dataBuffer, FieldSpec.DataType storedType, boolean isSingleValue)
-
-
Method Detail
-
getChunkBuffer
protected ByteBuffer getChunkBuffer(int docId, ChunkReaderContext context)
Helper method to return the chunk buffer that contains the value at the given document id.- If the chunk already exists in the reader context, returns the same.
- Otherwise, loads the chunk for the row, and sets it in the reader context.
- Parameters:
docId- Document idcontext- Reader context- Returns:
- Chunk for the row
-
decompressChunk
protected ByteBuffer decompressChunk(int chunkId, ChunkReaderContext context)
-
getChunkPosition
protected long getChunkPosition(int chunkId)
Helper method to get the offset of the chunk in the data.- Parameters:
chunkId- Id of the chunk for which to return the position.- Returns:
- Position (offset) of the chunk in the data.
-
isDictionaryEncoded
public boolean isDictionaryEncoded()
- Specified by:
isDictionaryEncodedin interfaceForwardIndexReader<ChunkReaderContext>
-
isSingleValue
public boolean isSingleValue()
- Specified by:
isSingleValuein interfaceForwardIndexReader<ChunkReaderContext>
-
getStoredType
public FieldSpec.DataType getStoredType()
- Specified by:
getStoredTypein interfaceForwardIndexReader<ChunkReaderContext>
-
readValuesSV
public void readValuesSV(int[] docIds, int length, int[] values, ChunkReaderContext context)- Specified by:
readValuesSVin interfaceForwardIndexReader<ChunkReaderContext>
-
readValuesSV
public void readValuesSV(int[] docIds, int length, long[] values, ChunkReaderContext context)- Specified by:
readValuesSVin interfaceForwardIndexReader<ChunkReaderContext>
-
readValuesSV
public void readValuesSV(int[] docIds, int length, float[] values, ChunkReaderContext context)- Specified by:
readValuesSVin interfaceForwardIndexReader<ChunkReaderContext>
-
readValuesSV
public void readValuesSV(int[] docIds, int length, double[] values, ChunkReaderContext context)- Specified by:
readValuesSVin interfaceForwardIndexReader<ChunkReaderContext>
-
close
public void close()
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable
-
-