Interface ColumnWriter

All Known Subinterfaces:
ArrayWriter, DictWriter, ObjectWriter, OffsetVectorWriter, RowSetLoader, RowSetWriter, ScalarWriter, TupleWriter, VariantWriter
All Known Implementing Classes:
AbstractArrayWriter, AbstractArrayWriter.ArrayObjectWriter, AbstractArrayWriter.BaseArrayWriter, AbstractFixedWidthWriter, AbstractFixedWidthWriter.BaseFixedWidthWriter, AbstractFixedWidthWriter.BaseIntWriter, AbstractObjectWriter, AbstractScalarWriter, AbstractScalarWriterImpl, AbstractScalarWriterImpl.ScalarObjectWriter, AbstractTupleWriter, AbstractTupleWriter.TupleObjectWriter, BaseScalarWriter, BaseVarWidthWriter, BitColumnWriter, ColumnAccessors.BigIntColumnWriter, ColumnAccessors.DateColumnWriter, ColumnAccessors.Decimal18ColumnWriter, ColumnAccessors.Decimal28SparseColumnWriter, ColumnAccessors.Decimal38SparseColumnWriter, ColumnAccessors.Decimal9ColumnWriter, ColumnAccessors.Float4ColumnWriter, ColumnAccessors.Float8ColumnWriter, ColumnAccessors.IntColumnWriter, ColumnAccessors.IntervalColumnWriter, ColumnAccessors.IntervalDayColumnWriter, ColumnAccessors.IntervalYearColumnWriter, ColumnAccessors.SmallIntColumnWriter, ColumnAccessors.TimeColumnWriter, ColumnAccessors.TimeStampColumnWriter, ColumnAccessors.TinyIntColumnWriter, ColumnAccessors.UInt1ColumnWriter, ColumnAccessors.UInt2ColumnWriter, ColumnAccessors.UInt4ColumnWriter, ColumnAccessors.UInt8ColumnWriter, ColumnAccessors.Var16CharColumnWriter, ColumnAccessors.VarBinaryColumnWriter, ColumnAccessors.VarCharColumnWriter, ColumnAccessors.VarDecimalColumnWriter, DictEntryWriter, DictEntryWriter.DictEntryObjectWriter, DummyArrayWriter, DummyArrayWriter.DummyOffsetVectorWriter, DummyDictWriter, DummyScalarWriter, ListWriterImpl, MapWriter, MapWriter.ArrayMapWriter, MapWriter.DummyArrayMapWriter, MapWriter.DummyMapWriter, MapWriter.SingleMapWriter, NullableScalarWriter, ObjectArrayWriter, ObjectDictWriter, ObjectDictWriter.DictObjectWriter, OffsetVectorWriterImpl, RepeatedListWriter, RowSetLoaderImpl, RowSetWriterImpl, ScalarArrayWriter, UnionWriterImpl, UnionWriterImpl.VariantObjectWriter

public interface ColumnWriter
Generic information about a column writer including:
  • Metadata
  • Write position information about a writer needed by a vector overflow implementation. Hides the details of implementation and the writer class hierarchy, exposing just the required write position information.
  • Generic methods for writing to the object, primarily used for testing.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Copy a single value from the given reader, which must be of the same type as this writer.
    boolean
    Whether this writer is projected (is backed by a materialized vector), or is unprojected (is just a dummy writer.) In most cases, clients can ignore whether the column is projected and just write to the writer.
    boolean
    Whether this writer allows nulls.
    Returns the schema of the column associated with this writer.
    void
    Set the current value to null.
    void
    Generic technique to write data as a generic Java object.
    Return the object (structure) type of this writer.
  • Method Details

    • type

      ObjectType type()
      Return the object (structure) type of this writer.
      Returns:
      type indicating if this is a scalar, tuple or array
    • nullable

      boolean nullable()
      Whether this writer allows nulls. This is not as simple as checking for the TypeProtos.DataMode.OPTIONAL type in the schema. List entries are nullable, if they are primitive, but not if they are maps or lists. Unions are nullable, regardless of cardinality.
      Returns:
      true if a call to setNull() is supported, false if not
    • isProjected

      boolean isProjected()
      Whether this writer is projected (is backed by a materialized vector), or is unprojected (is just a dummy writer.) In most cases, clients can ignore whether the column is projected and just write to the writer. This flag handles those special cases where it is helpful to know if the column is projected or not.
    • schema

      ColumnMetadata schema()
      Returns the schema of the column associated with this writer.
      Returns:
      schema for this writer's column
    • setNull

      void setNull()
      Set the current value to null. Support depends on the underlying implementation: only nullable types support this operation. throws IllegalStateException if called on a non-nullable value.
    • copy

      void copy(ColumnReader from)
      Copy a single value from the given reader, which must be of the same type as this writer.
      Parameters:
      from - reader to provide the data
    • setObject

      void setObject(Object value)
      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.
      Parameters:
      value - value to write to the vector. The Java type of the object indicates the Drill storage type
      Throws:
      IllegalArgumentException - if the type of the Java object cannot be mapped to the type of the underlying vector or vector structure