Class BaseOnHeapMutableDictionary
- java.lang.Object
-
- org.apache.pinot.segment.local.realtime.impl.dictionary.BaseOnHeapMutableDictionary
-
- All Implemented Interfaces:
Closeable,AutoCloseable,IndexReader,MutableDictionary,Dictionary
- Direct Known Subclasses:
BigDecimalOnHeapMutableDictionary,BytesOnHeapMutableDictionary,DoubleOnHeapMutableDictionary,FloatOnHeapMutableDictionary,IntOnHeapMutableDictionary,LongOnHeapMutableDictionary,StringOnHeapMutableDictionary
public abstract class BaseOnHeapMutableDictionary extends Object implements MutableDictionary
The classBaseOnHeapMutableDictionaryis the implementation of the mutable dictionary required by REALTIME consuming segments.The implementation needs to be thread safe for single writer multiple readers scenario.
We can assume the readers always first get the dictionary id for a value, then use the dictionary id to fetch the value later, but not reversely. So whenever we return a valid dictionary id for a value, we need to ensure the value can be fetched by the dictionary id returned.
-
-
Field Summary
-
Fields inherited from interface org.apache.pinot.segment.spi.index.reader.Dictionary
NULL_VALUE_INDEX
-
-
Constructor Summary
Constructors Constructor Description BaseOnHeapMutableDictionary()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Objectget(int dictId)For performance, we don't validate the dictId passed in.protected intgetDictId(Object value)Get the dictId of a single value.protected intindexValue(Object value)Index a single value.intlength()-
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.Dictionary
compare, getBigDecimalValue, getByteArrayValue, getBytesValue, getDictIds, getDictIdsInRange, getDoubleValue, getFloatValue, getInternal, getIntValue, getLongValue, getMaxVal, getMinVal, getSortedValues, getStringValue, getValueType, indexOf, indexOf, indexOf, indexOf, indexOf, indexOf, indexOf, readBigDecimalValues, readBytesValues, readDoubleValues, readFloatValues, readIntValues, readLongValues, readStringValues
-
Methods inherited from interface org.apache.pinot.segment.spi.index.mutable.MutableDictionary
index, index, insertionIndexOf, isSorted
-
-
-
-
Method Detail
-
get
public Object get(int dictId)
For performance, we don't validate the dictId passed in. It should be returned by index() or indexOf().- Specified by:
getin interfaceDictionary
-
length
public int length()
- Specified by:
lengthin interfaceDictionary
-
close
public void close() throws IOException- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-
indexValue
protected int indexValue(Object value)
Index a single value.This method will only be called by a single writer thread.
- Parameters:
value- single value already converted to correct type.
-
getDictId
protected int getDictId(Object value)
Get the dictId of a single value.This method will only be called by a single writer thread.
- Parameters:
value- single value already converted to correct type.- Returns:
- dictId of the value.
-
-