java.lang.Object
org.apache.drill.exec.physical.resultSet.impl.ColumnState
Direct Known Subclasses:
ColumnState.BaseContainerColumnState, ColumnState.PrimitiveColumnState

public abstract class ColumnState extends Object
Represents the write-time state for a column including the writer and the (optional) backing vector. Implements per-column operations such as vector overflow. If a column is a (possibly repeated) map, then the column state will hold a tuple state.

If a column is not projected, then the writer exists (to make life easier for the reader), but there will be no vector backing the writer.

Different columns need different kinds of vectors: a data vector, possibly an offset vector, or even a non-existent vector. The VectorState class abstracts out these differences.

  • Field Details

    • loader

      protected final org.apache.drill.exec.physical.resultSet.impl.LoaderInternals loader
    • addVersion

      protected final int addVersion
    • vectorState

      protected final VectorState vectorState
    • state

      protected ColumnState.State state
    • writer

      protected AbstractObjectWriter writer
    • cardinality

      protected int cardinality
      Cardinality of the value itself. If this is an array, then this is the number of arrays. A separate number, the inner cardinality, is computed as the outer cardinality times the expected array count (from metadata.) The inner cardinality is the total number of array items in the vector.
    • outputIndex

      protected int outputIndex
  • Constructor Details

    • ColumnState

      public ColumnState(org.apache.drill.exec.physical.resultSet.impl.LoaderInternals loader, AbstractObjectWriter writer, VectorState vectorState)
  • Method Details

    • writer

      public AbstractObjectWriter writer()
    • schema

      public ColumnMetadata schema()
    • vectorState

      public VectorState vectorState()
    • vector

      public <T extends ValueVector> T vector()
    • allocateVectors

      public void allocateVectors()
    • startBatch

      public void startBatch(boolean schemaOnly)
      Prepare the column for a new row batch after overflow on the previous batch. Restore the look-ahead buffer to the active vector so we start writing where we left off.
    • rollover

      public void rollover()
      A column within the row batch overflowed. Prepare to absorb the rest of the in-flight row by rolling values over to a new vector, saving the complete vector for later. This column could have a value for the overflow row, or for some previous row, depending on exactly when and where the overflow occurs.
    • harvestWithLookAhead

      public void harvestWithLookAhead()
      Writing of a row batch is complete. Prepare the vector for harvesting to send downstream. If this batch encountered overflow, set aside the look-ahead vector and put the full vector buffer back into the active vector.
    • isProjected

      public boolean isProjected()
    • updateCardinality

      public void updateCardinality(int cardinality)
    • outerCardinality

      public int outerCardinality()
    • innerCardinality

      public int innerCardinality()
    • buildOutput

      public void buildOutput(TupleState tupleState)
    • outputSchema

      public abstract ColumnMetadata outputSchema()
    • close

      public void close()
    • dump

      public void dump(HierarchicalFormatter format)