Class ColumnState
java.lang.Object
org.apache.drill.exec.physical.resultSet.impl.ColumnState
- Direct Known Subclasses:
ColumnState.BaseContainerColumnState
,ColumnState.PrimitiveColumnState
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.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
static class
Primitive (non-map) column state.protected static enum
Columns move through various lifecycle states as identified by this enum. -
Field Summary
Modifier and TypeFieldDescriptionprotected final int
protected int
Cardinality of the value itself.protected final org.apache.drill.exec.physical.resultSet.impl.LoaderInternals
protected int
protected ColumnState.State
protected final VectorState
protected AbstractObjectWriter
-
Constructor Summary
ConstructorDescriptionColumnState
(org.apache.drill.exec.physical.resultSet.impl.LoaderInternals loader, AbstractObjectWriter writer, VectorState vectorState) -
Method Summary
Modifier and TypeMethodDescriptionvoid
void
buildOutput
(TupleState tupleState) void
close()
void
dump
(HierarchicalFormatter format) void
Writing of a row batch is complete.int
boolean
int
abstract ColumnMetadata
void
rollover()
A column within the row batch overflowed.schema()
void
startBatch
(boolean schemaOnly) Prepare the column for a new row batch after overflow on the previous batch.void
updateCardinality
(int cardinality) <T extends ValueVector>
Tvector()
writer()
-
Field Details
-
loader
protected final org.apache.drill.exec.physical.resultSet.impl.LoaderInternals loader -
addVersion
protected final int addVersion -
vectorState
-
state
-
writer
-
cardinality
protected int cardinalityCardinality 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
-
schema
-
vectorState
-
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
-
outputSchema
-
close
public void close() -
dump
-