Class BinaryDictionary

java.lang.Object
dev.hardwood.reader.BinaryDictionary
All Implemented Interfaces:
ColumnDictionary

@Experimental public final class BinaryDictionary extends Object implements ColumnDictionary

The dictionary of a BYTE_ARRAY, FIXED_LEN_BYTE_ARRAY or INT96 column chunk, from ColumnReader.getBinaryDictionary(). Its entries never change, and it may be read from any thread. Every batch drawn from the same dictionary returns the same instance, so comparing it with the previous batch's (!=) tells when the dictionary changed.

This API is Experimental: it may change in future releases without prior deprecation.

  • Method Details

    • size

      public int size()
      Description copied from interface: ColumnDictionary
      The number of entries; entry ids run from 0 to size() - 1.
      Specified by:
      size in interface ColumnDictionary
    • getBinary

      public byte[] getBinary(int entry)
      A copy of entry entry.
      Throws:
      IndexOutOfBoundsException - if entry is not in [0, size())
    • getString

      public String getString(int entry)
      Entry entry decoded as UTF-8. The result is cached for later calls, but compare it with equals: calls from several threads may each decode the entry and return distinct, equal strings. The column has to hold text, as for ColumnReader.getStrings().
      Throws:
      IllegalArgumentException - if the column does not hold text
      IndexOutOfBoundsException - if entry is not in [0, size())