Package org.apache.orc.impl
Class StringHashTableDictionary
java.lang.Object
org.apache.orc.impl.StringHashTableDictionary
- All Implemented Interfaces:
Dictionary
Using HashTable to represent a dictionary. The strings are stored as UTF-8 bytes
and an offset for each entry. It is using chaining for collision resolution.
This implementation is not thread-safe.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.orc.impl.Dictionary
Dictionary.IMPL, Dictionary.Visitor, Dictionary.VisitorContext -
Field Summary
Fields inherited from interface org.apache.orc.impl.Dictionary
INITIAL_DICTIONARY_SIZE -
Constructor Summary
ConstructorsConstructorDescriptionStringHashTableDictionary(int initialCapacity) StringHashTableDictionary(int initialCapacity, float loadFactor) -
Method Summary
Modifier and TypeMethodDescriptionintadd(byte[] bytes, int offset, int length) intvoidclear()longgetText(int positionInKeyOffset) voidGiven the position index, return the original string before being encoded.intsize()voidvisit(Dictionary.Visitor visitor) Traverse the whole dictionary and apply the action.intwriteTo(OutputStream out, int position) Given the position index, write the original string, before being encoded, to the OutputStream.
-
Constructor Details
-
StringHashTableDictionary
public StringHashTableDictionary(int initialCapacity) -
StringHashTableDictionary
public StringHashTableDictionary(int initialCapacity, float loadFactor)
-
-
Method Details
-
visit
Description copied from interface:DictionaryTraverse the whole dictionary and apply the action.- Specified by:
visitin interfaceDictionary- Throws:
IOException
-
clear
public void clear()- Specified by:
clearin interfaceDictionary
-
getText
Description copied from interface:DictionaryGiven the position index, return the original string before being encoded. The value of the Text in the Dictionary is copied intoresult.- Specified by:
getTextin interfaceDictionary- Parameters:
result- the holder to copy the dictionary text intopositionInKeyOffset- the position where the key was added
-
getText
- Specified by:
getTextin interfaceDictionary
-
writeTo
Description copied from interface:DictionaryGiven the position index, write the original string, before being encoded, to the OutputStream.- Specified by:
writeToin interfaceDictionary- Parameters:
out- the output stream to which to write the dataposition- the position where the key was originally added- Returns:
- the number of byte written to the stream
- Throws:
IOException- if an I/O error occurs
-
add
-
add
public int add(byte[] bytes, int offset, int length) - Specified by:
addin interfaceDictionary
-
size
public int size()- Specified by:
sizein interfaceDictionary
-
getSizeInBytes
public long getSizeInBytes()- Specified by:
getSizeInBytesin interfaceDictionary
-