Class DummyScalarWriter

All Implemented Interfaces:
ColumnWriter, ScalarWriter, ValueWriter, WriterEvents, WriterPosition
Direct Known Subclasses:
DummyArrayWriter.DummyOffsetVectorWriter

public class DummyScalarWriter extends AbstractScalarWriterImpl
Represents a non-projected column. The writer accepts data, but discards it. The writer does not participate in writer events, nor is it backed by a real vector, index or type.
  • Constructor Details

  • Method Details

    • bindListener

      public void bindListener(WriterEvents.ColumnWriterListener listener)
      Description copied from interface: WriterEvents
      Bind a listener to the underlying vector writer. This listener reports on vector events (overflow, growth), and so is called only when the writer is backed by a vector. The listener is ignored (and never called) for dummy (non-projected) columns. If the column is compound (such as for a nullable or repeated column, or for a map), then the writer is bound to the individual components.
      Specified by:
      bindListener in interface WriterEvents
      Overrides:
      bindListener in class AbstractScalarWriter
      Parameters:
      listener - the vector event listener to bind
    • valueType

      public ValueType valueType()
      Description copied from interface: ScalarWriter
      Describe the type of the value. This is a compression of the value vector type: it describes which method will return the vector value.
      Returns:
      the value type which indicates which get method is valid for the column
    • nullable

      public boolean nullable()
      Description copied from interface: ColumnWriter
      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 ColumnWriter.setNull() is supported, false if not
    • setNull

      public void setNull()
      Description copied from interface: ColumnWriter
      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.
    • setBoolean

      public void setBoolean(boolean value)
    • setInt

      public void setInt(int value)
    • setLong

      public void setLong(long value)
    • setFloat

      public void setFloat(float value)
    • setDouble

      public void setDouble(double value)
    • setString

      public void setString(String value)
    • setBytes

      public void setBytes(byte[] value, int len)
    • appendBytes

      public void appendBytes(byte[] value, int len)
    • setDecimal

      public void setDecimal(BigDecimal value)
    • setPeriod

      public void setPeriod(org.joda.time.Period value)
    • bindIndex

      public void bindIndex(ColumnWriterIndex index)
      Description copied from interface: WriterEvents
      Bind the writer to a writer index.
      Specified by:
      bindIndex in interface WriterEvents
      Overrides:
      bindIndex in class AbstractScalarWriterImpl
      Parameters:
      index - the writer index (top level or nested for arrays)
    • restartRow

      public void restartRow()
      Description copied from interface: WriterEvents
      During a writer to a row, rewind the the current index position to restart the row. Done when abandoning the current row, such as when filtering out a row at read time.
    • endWrite

      public void endWrite()
      Description copied from interface: WriterEvents
      End a batch: finalize any vector values.
    • preRollover

      public void preRollover()
      Description copied from interface: WriterEvents
      The vectors backing this vector are about to roll over. Finish the current batch up to, but not including, the current row.
    • postRollover

      public void postRollover()
      Description copied from interface: WriterEvents
      The vectors backing this writer rolled over. This means that data for the current row has been rolled over into a new vector. Offsets and indexes should be shifted based on the understanding that data for the current row now resides at the start of a new vector instead of its previous location elsewhere in an old vector.
    • lastWriteIndex

      public int lastWriteIndex()
      Description copied from interface: WriterPosition
      Return the last write position in the vector. This may be the same as the writer index position (if the vector was written at that point), or an earlier point. In either case, this value points to the last valid value in the vector.
      Returns:
      index of the last valid value in the vector
    • vector

      public BaseDataValueVector vector()
      Specified by:
      vector in class AbstractScalarWriterImpl
    • rowStartIndex

      public int rowStartIndex()
      Description copied from interface: WriterPosition
      Position within the vector of the first value for the current row. Note that this is always the first value for the row, even for a writer deeply nested within a hierarchy of arrays. (The first position for the current array is not exposed in this API.)
      Specified by:
      rowStartIndex in interface WriterPosition
      Overrides:
      rowStartIndex in class AbstractScalarWriterImpl
      Returns:
      the vector offset of the first value for the current row
    • setDate

      public void setDate(LocalDate value)
    • setTime

      public void setTime(LocalTime value)
    • setTimestamp

      public void setTimestamp(Instant value)
    • setValue

      public void setValue(Object value)
      Description copied from interface: ValueWriter
      Write value to a vector as a Java object of the "native" type for the column. This form is available only on scalar writers. The object must be of the form for the primary write method above.

      Primarily to be used when the code already knows the object type.

      Parameters:
      value - a value that matches the primary setter above, or null to set the column to null
      See Also:
    • setDefaultValue

      public void setDefaultValue(Object value)
      Description copied from interface: ScalarWriter
      Set the default value to be used to fill empties for this writer. Only valid for required writers: null writers set this is-set bit to 0 and set the data value to 0.
      Parameters:
      value - the value to set. Cannot be null. The type of the value must match that legal for ValueWriter.setValue(Object)
    • isProjected

      public boolean isProjected()
      Description copied from interface: ColumnWriter
      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.
      Specified by:
      isProjected in interface ColumnWriter
      Overrides:
      isProjected in class AbstractScalarWriterImpl
    • copy

      public void copy(ColumnReader from)
      Description copied from interface: ColumnWriter
      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