Class StringHashTableDictionary

java.lang.Object
org.apache.orc.impl.StringHashTableDictionary
All Implemented Interfaces:
Dictionary

public class StringHashTableDictionary extends Object implements 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.

  • Constructor Details

    • StringHashTableDictionary

      public StringHashTableDictionary(int initialCapacity)
    • StringHashTableDictionary

      public StringHashTableDictionary(int initialCapacity, float loadFactor)
  • Method Details

    • visit

      public void visit(Dictionary.Visitor visitor) throws IOException
      Description copied from interface: Dictionary
      Traverse the whole dictionary and apply the action.
      Specified by:
      visit in interface Dictionary
      Throws:
      IOException
    • clear

      public void clear()
      Specified by:
      clear in interface Dictionary
    • getText

      public void getText(Text result, int positionInKeyOffset)
      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 into result.
      Specified by:
      getText in interface Dictionary
      Parameters:
      result - the holder to copy the dictionary text into
      positionInKeyOffset - the position where the key was added
    • getText

      public ByteBuffer getText(int positionInKeyOffset)
      Specified by:
      getText in interface Dictionary
    • writeTo

      public int writeTo(OutputStream out, int position) throws IOException
      Description copied from interface: Dictionary
      Given the position index, write the original string, before being encoded, to the OutputStream.
      Specified by:
      writeTo in interface Dictionary
      Parameters:
      out - the output stream to which to write the data
      position - 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

      public int add(Text text)
    • add

      public int add(byte[] bytes, int offset, int length)
      Specified by:
      add in interface Dictionary
    • size

      public int size()
      Specified by:
      size in interface Dictionary
    • getSizeInBytes

      public long getSizeInBytes()
      Specified by:
      getSizeInBytes in interface Dictionary