Package org.apache.druid.segment.data
Interface DictionaryWriter<T>
- All Superinterfaces:
Serializer
- All Known Implementing Classes:
EncodedStringDictionaryWriter,FixedIndexedWriter,FrontCodedIndexedWriter,FrontCodedIntArrayIndexedWriter,GenericIndexedWriter
-
Method Summary
Modifier and TypeMethodDescriptionget(int dictId) Returns an object that has already been written via thewrite(T)method.intReturns the number of items that have been written so far in this dictionary.booleanisSorted()voidopen()Prepares the writer for writingintWrites an object to the dictionary.Methods inherited from interface org.apache.druid.segment.serde.Serializer
getSerializedSize, writeTo
-
Method Details
-
isSorted
boolean isSorted() -
open
Prepares the writer for writing- Throws:
IOException- if there is a problem with IO
-
write
Writes an object to the dictionary.Returns the index of the value that was just written. This is defined as the `int` value that can be passed into
get(int)such that it will return the same value back.- Parameters:
objectToWrite- object to be written to the dictionary- Returns:
- index of the value that was just written
- Throws:
IOException- if there is a problem with IO
-
get
Returns an object that has already been written via thewrite(T)method.- Parameters:
dictId- index of the object to return- Returns:
- the object identified by the given index
- Throws:
IOException- if there is a problem with IO
-
getCardinality
int getCardinality()Returns the number of items that have been written so far in this dictionary. Any number lower than this cardinality can be passed intoget(int)and a value will be returned. If a value greater than or equal to the cardinality is passed intoget(int)all sorts of things could happen, but likely none of them are good.- Returns:
- the number of items that have been written so far
-