Class FixedByteMVMutableForwardIndex
- java.lang.Object
-
- org.apache.pinot.segment.local.realtime.impl.forward.FixedByteMVMutableForwardIndex
-
- All Implemented Interfaces:
Closeable,AutoCloseable,IndexReader,MutableForwardIndex,MutableIndex,ForwardIndexReader<ForwardIndexReaderContext>
public class FixedByteMVMutableForwardIndex extends Object implements MutableForwardIndex
This class provides expandable off-heap implementation to store a multi-valued column across a number of rows. The maximum number of values in any row must be known while invoking the constructor. Other than that, this class allocates additional memory as needed to accommodate any number of rows. Writes into the data structure are strictly sequential, but reads can be random. Writes are of type: setIntArray(int rowNumber, int[] values) It is expected that rowNumber starts with 0 and increments by 1 on each invocation, and that it is decided ahead of time that the class is used to store a certain type of data structure (int arrays, or char arrays, etc.) Mix & match is not allowed. Two kinds of data structures are used in this class. 1. A header (essentially an index into the other data structure) that has one entry per row. The entry has 3 integers - data buffer ID - offset in the data buffer where column values start - length (number of values in the multi-valued column). New header structures are added as new rows come in. Each header class holds the same number of rows (for easy lookup) 2. A data buffer that has the values for the column that the header points to. Data buffers are added as needed, whenever we reach a limitation that we cannot fit the values of a column in the current buffer. Note that data buffers and headers grow independently. Data formatHEADER SECTION 0 bufferId startIndex length bufferId startIndex length bufferId startIndex length ... HEADER SECTION 1 bufferId startIndex length bufferId startIndex length bufferId startIndex length ... Data BUFFER SECTION 0 [set of values of row 0] [set of values of row 1] ..... [set of values of row m] Data BUFFER SECTION 1 [set of values of row m +1 ] [set of values of row M +2] ..... [set of values of row ] Data BUFFER SECTION N [set of values of row ... ] [set of values of row ...] ..... [set of values of row n]
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.pinot.segment.spi.index.reader.ForwardIndexReader
ForwardIndexReader.ByteRange
-
-
Constructor Summary
Constructors Constructor Description FixedByteMVMutableForwardIndex(int maxNumberOfMultiValuesPerRow, int avgMultiValueCount, int rowCountPerChunk, int columnSizeInBytes, PinotDataBufferMemoryManager memoryManager, String context, boolean isDictionaryEncoded, FieldSpec.DataType storedType)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()int[]getDictIdMV(int docId)intgetDictIdMV(int docId, int[] dictIdBuffer)double[]getDoubleMV(int docId)intgetDoubleMV(int docId, double[] valueBuffer)float[]getFloatMV(int docId)intgetFloatMV(int docId, float[] valueBuffer)int[]getIntMV(int docId)intgetIntMV(int docId, int[] valueBuffer)intgetLengthOfLongestElement()intgetLengthOfShortestElement()long[]getLongMV(int docId)intgetLongMV(int docId, long[] valueBuffer)intgetNumValuesMV(int docId)FieldSpec.DataTypegetStoredType()booleanisDictionaryEncoded()booleanisSingleValue()voidsetDictIdMV(int docId, int[] dictIds)voidsetDoubleMV(int docId, double[] values)voidsetFloatMV(int docId, float[] values)voidsetIntMV(int docId, int[] values)voidsetLongMV(int docId, long[] values)-
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, getCompressionType, getDictIdCompressionType, getDocLength, getLengthOfLongestEntry, getRawDataStartOffset, isBufferByteRangeInfoSupported, isDocLengthInBits, isFixedOffsetMappingType, readValuesMV, readValuesMV, readValuesMV, readValuesMV, readValuesMV, readValuesMV, readValuesSV, readValuesSV, readValuesSV, readValuesSV, readValuesSV, recordDocIdByteRanges
-
Methods inherited from interface org.apache.pinot.segment.spi.index.mutable.MutableForwardIndex
add, add, getBigDecimal, getBigDecimal, getBytes, getBytes, getBytesMV, getBytesMV, getBytesMV, getBytesMV, getDictId, getDictId, getDictIdMV, getDictIdMV, getDouble, getDouble, getDoubleMV, getDoubleMV, getFloat, getFloat, getFloatMV, getFloatMV, getInt, getInt, getIntMV, getIntMV, getLong, getLong, getLongMV, getLongMV, getNumValuesMV, getString, getString, getStringMV, getStringMV, getStringMV, getStringMV, readDictIds, readDictIds, setBigDecimal, setBytes, setBytesMV, setDictId, setDouble, setFloat, setInt, setLong, setString, setStringMV
-
-
-
-
Constructor Detail
-
FixedByteMVMutableForwardIndex
public FixedByteMVMutableForwardIndex(int maxNumberOfMultiValuesPerRow, int avgMultiValueCount, int rowCountPerChunk, int columnSizeInBytes, PinotDataBufferMemoryManager memoryManager, String context, boolean isDictionaryEncoded, FieldSpec.DataType storedType)
-
-
Method Detail
-
isDictionaryEncoded
public boolean isDictionaryEncoded()
- Specified by:
isDictionaryEncodedin interfaceForwardIndexReader<ForwardIndexReaderContext>
-
isSingleValue
public boolean isSingleValue()
- Specified by:
isSingleValuein interfaceForwardIndexReader<ForwardIndexReaderContext>
-
getStoredType
public FieldSpec.DataType getStoredType()
- Specified by:
getStoredTypein interfaceForwardIndexReader<ForwardIndexReaderContext>
-
getLengthOfShortestElement
public int getLengthOfShortestElement()
- Specified by:
getLengthOfShortestElementin interfaceMutableForwardIndex
-
getLengthOfLongestElement
public int getLengthOfLongestElement()
- Specified by:
getLengthOfLongestElementin interfaceMutableForwardIndex
-
getDictIdMV
public int getDictIdMV(int docId, int[] dictIdBuffer)- Specified by:
getDictIdMVin interfaceMutableForwardIndex
-
getDictIdMV
public int[] getDictIdMV(int docId)
- Specified by:
getDictIdMVin interfaceMutableForwardIndex
-
getIntMV
public int getIntMV(int docId, int[] valueBuffer)- Specified by:
getIntMVin interfaceMutableForwardIndex
-
getIntMV
public int[] getIntMV(int docId)
- Specified by:
getIntMVin interfaceMutableForwardIndex
-
getLongMV
public int getLongMV(int docId, long[] valueBuffer)- Specified by:
getLongMVin interfaceMutableForwardIndex
-
getLongMV
public long[] getLongMV(int docId)
- Specified by:
getLongMVin interfaceMutableForwardIndex
-
getFloatMV
public int getFloatMV(int docId, float[] valueBuffer)- Specified by:
getFloatMVin interfaceMutableForwardIndex
-
getFloatMV
public float[] getFloatMV(int docId)
- Specified by:
getFloatMVin interfaceMutableForwardIndex
-
getDoubleMV
public int getDoubleMV(int docId, double[] valueBuffer)- Specified by:
getDoubleMVin interfaceMutableForwardIndex
-
getDoubleMV
public double[] getDoubleMV(int docId)
- Specified by:
getDoubleMVin interfaceMutableForwardIndex
-
getNumValuesMV
public int getNumValuesMV(int docId)
- Specified by:
getNumValuesMVin interfaceMutableForwardIndex
-
setDictIdMV
public void setDictIdMV(int docId, int[] dictIds)- Specified by:
setDictIdMVin interfaceMutableForwardIndex
-
setIntMV
public void setIntMV(int docId, int[] values)- Specified by:
setIntMVin interfaceMutableForwardIndex
-
setLongMV
public void setLongMV(int docId, long[] values)- Specified by:
setLongMVin interfaceMutableForwardIndex
-
setFloatMV
public void setFloatMV(int docId, float[] values)- Specified by:
setFloatMVin interfaceMutableForwardIndex
-
setDoubleMV
public void setDoubleMV(int docId, double[] values)- Specified by:
setDoubleMVin interfaceMutableForwardIndex
-
close
public void close() throws IOException- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-
-