Class ContainerState
java.lang.Object
org.apache.drill.exec.physical.resultSet.impl.ContainerState
- Direct Known Subclasses:
ListState,RepeatedListState,TupleState,UnionState
Abstract representation of a container of vectors: a row, a map, a
repeated map, a list or a union.
The container is responsible for creating new columns in response from a writer listener event. Column creation requires a set of four items:
- The value vector (which may be null if the column is not projected.
- The writer for the column.
- A vector state that manages allocation, overflow, cleanup and other vector-specific tasks.
- A column state which orchestrates the above three items.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final org.apache.drill.exec.physical.resultSet.impl.LoaderInternalsprotected ColumnStateprotected final ProjectionFilterprotected final ResultVectorCacheVector cache for this loader. -
Constructor Summary
ConstructorsConstructorDescriptionContainerState(org.apache.drill.exec.physical.resultSet.impl.LoaderInternals loader, ResultVectorCache vectorCache) ContainerState(org.apache.drill.exec.physical.resultSet.impl.LoaderInternals loader, ResultVectorCache vectorCache, ProjectionFilter projectionSet) -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract voidaddColumn(ColumnState colState) addColumn(ColumnMetadata columnSchema) voidbindColumnState(ColumnState parentState) voidclose()Clean up state (such as backup vectors) associated with the state for each vector.protected abstract Collection<ColumnState> voidWriting of a row batch is complete, and an overflow occurred.abstract intprotected abstract booleanReports whether this container is subject to version management.protected org.apache.drill.exec.physical.resultSet.impl.LoaderInternalsloader()protected ProjectionFiltervoidrollover()A column within the row batch overflowed.voidstartBatch(boolean schemaOnly) Start a new batch by shifting the overflow buffers back into the main write vectors and updating the writers.voidIn order to allocate the correct-sized vectors, the container must know its member cardinality: the number of elements in each row.
-
Field Details
-
loader
protected final org.apache.drill.exec.physical.resultSet.impl.LoaderInternals loader -
projectionSet
-
parentColumn
-
vectorCache
Vector cache for this loader. .
-
-
Constructor Details
-
ContainerState
public ContainerState(org.apache.drill.exec.physical.resultSet.impl.LoaderInternals loader, ResultVectorCache vectorCache, ProjectionFilter projectionSet) -
ContainerState
public ContainerState(org.apache.drill.exec.physical.resultSet.impl.LoaderInternals loader, ResultVectorCache vectorCache)
-
-
Method Details
-
bindColumnState
-
innerCardinality
public abstract int innerCardinality() -
addColumn
-
columnStates
-
projection
-
isVersioned
protected abstract boolean isVersioned()Reports whether this container is subject to version management. Version management adds columns to the output container at harvest time based on whether they should appear in the output batch.- Returns:
trueif versioned
-
loader
protected org.apache.drill.exec.physical.resultSet.impl.LoaderInternals loader() -
vectorCache
-
addColumn
-
updateCardinality
public void updateCardinality()In order to allocate the correct-sized vectors, the container must know its member cardinality: the number of elements in each row. This is 1 for a single map or union, but may be any number for a map array or a list. Then, this value is recursively pushed downward to compute the cardinality of lists of maps that contains lists of maps, and so on. -
startBatch
public void startBatch(boolean schemaOnly) Start a new batch by shifting the overflow buffers back into the main write vectors and updating the writers. -
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, and an overflow occurred. Prepare the vector for harvesting to send downstream. Set aside the look-ahead vector and put the full vector buffer back into the active vector. -
close
public void close()Clean up state (such as backup vectors) associated with the state for each vector.
-