Class ObjectDictWriter

All Implemented Interfaces:
ArrayWriter, ColumnWriter, DictWriter, WriterEvents, WriterPosition

public class ObjectDictWriter extends ObjectArrayWriter implements DictWriter
The implementation represents the writer as an array writer with special dict entry writer as its element writer.
  • Field Details

  • Constructor Details

  • Method Details

    • buildDict

      public static ObjectDictWriter.DictObjectWriter buildDict(ColumnMetadata metadata, DictVector vector, List<AbstractObjectWriter> keyValueWriters)
    • buildDictArray

      public static AbstractArrayWriter.ArrayObjectWriter buildDictArray(ColumnMetadata metadata, RepeatedDictVector vector, List<AbstractObjectWriter> keyValueWriters)
    • keyType

      public ValueType keyType()
      Description copied from interface: DictWriter
      Returns scalar type of the key field.
      Specified by:
      keyType in interface DictWriter
      Returns:
      type of the key
    • valueType

      public ObjectType valueType()
      Description copied from interface: DictWriter
      Returns object type of the value field.
      Specified by:
      valueType in interface DictWriter
      Returns:
      type of the value
    • keyWriter

      public ScalarWriter keyWriter()
      Description copied from interface: DictWriter
      Returns the writer associated with key field.
      Specified by:
      keyWriter in interface DictWriter
      Returns:
      key writer
    • valueWriter

      public ObjectWriter valueWriter()
      Description copied from interface: DictWriter
      Returns the writer associated with value field.
      Specified by:
      valueWriter in interface DictWriter
      Returns:
      value writer
    • setObject

      public void setObject(Object object)
      Description copied from interface: ColumnWriter
      Generic technique to write data as a generic Java object. The type of the object must match the target writer. Primarily for testing.
      • Scalar: The type of the Java object must match the type of the target vector. String or byte[] can be used for Varchar vectors.
      • Array: Write the array given an array of values. The object must be a Java array. The type of the array must match the type of element in the repeated vector. That is, if the vector is a Repeated Int, provide an int[] array.
      • Tuple (map or row): The Java object must be an array of objects in which the members of the array have a 1:1 correspondence with the members of the tuple in the order defined by the writer metadata. That is, if the map is (Int, Varchar), provide a Object[] array like this: {10, "fred"}.
      • Union: Uses the Java object type to determine the type of the backing vector. Creates a vector of the required type if needed.
      Specified by:
      setObject in interface ColumnWriter
      Overrides:
      setObject in class ObjectArrayWriter
      Parameters:
      object - value to write to the vector. The Java type of the object indicates the Drill storage type