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
ConstructorDescriptionStringHashTableDictionary
(int initialCapacity) StringHashTableDictionary
(int initialCapacity, float loadFactor) -
Method Summary
Modifier and TypeMethodDescriptionint
add
(byte[] bytes, int offset, int length) int
void
clear()
long
getText
(int positionInKeyOffset) void
Given the position index, return the original string before being encoded.int
size()
void
visit
(Dictionary.Visitor visitor) Traverse the whole dictionary and apply the action.int
writeTo
(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:Dictionary
Traverse the whole dictionary and apply the action.- Specified by:
visit
in interfaceDictionary
- Throws:
IOException
-
clear
public void clear()- Specified by:
clear
in interfaceDictionary
-
getText
Description copied from interface:Dictionary
Given the position index, return the original string before being encoded. The value of the Text in the Dictionary is copied intoresult
.- Specified by:
getText
in interfaceDictionary
- Parameters:
result
- the holder to copy the dictionary text intopositionInKeyOffset
- the position where the key was added
-
getText
- Specified by:
getText
in interfaceDictionary
-
writeTo
Description copied from interface:Dictionary
Given the position index, write the original string, before being encoded, to the OutputStream.- Specified by:
writeTo
in 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:
add
in interfaceDictionary
-
size
public int size()- Specified by:
size
in interfaceDictionary
-
getSizeInBytes
public long getSizeInBytes()- Specified by:
getSizeInBytes
in interfaceDictionary
-