public abstract class TupleState extends ContainerState implements AbstractTupleWriter.TupleWriterListener
Here, by "tuple" we mean a container of vectors, each of which holds a variety of values. So, the "tuple" here is structural, not a specific set of values, but rather the collection of vectors that hold tuple values. Drill vector containers and maps are both tuples, but they irritatingly have completely different APIs for working with their child vectors. These classes are a proxy to wrap the two APIs to provide a common view for the use the result set builder and its internals.
Because a Drill row is actually a hierarchy, walks the internal hierarchy and builds a corresponding output hierarchy.
As special case occurs when columns are added in the overflow row. These columns do not appear in the output container for the main part of the batch; instead they appear in the next output container that includes the overflow row.
Since the container here may contain a subset of the internal columns, an interesting case occurs for maps. The maps in the output container are not the same as those used internally. Since a map column can contain either one list of columns or another, the internal and external maps must differ. The set of child vectors (except for child maps) are shared.
Modifier and Type | Class and Description |
---|---|
static class |
TupleState.DictArrayState |
static class |
TupleState.DictArrayVectorState |
static class |
TupleState.DictColumnState |
static class |
TupleState.DictState |
static class |
TupleState.DictVectorState<T extends ValueVector> |
static class |
TupleState.MapArrayState |
static class |
TupleState.MapColumnState
Represents a map column (either single or repeated).
|
static class |
TupleState.MapState
Represents a tuple defined as a Drill map: single or repeated.
|
static class |
TupleState.MapVectorState
State for a map vector.
|
static class |
TupleState.RowState
Handles the details of the top-level tuple, the data row itself.
|
static class |
TupleState.SingleDictState |
static class |
TupleState.SingleDictVectorState |
static class |
TupleState.SingleMapState |
Modifier and Type | Field and Description |
---|---|
protected List<ColumnState> |
columns
The set of columns added via the writers: includes both projected
and unprojected columns.
|
protected TupleMetadata |
outputSchema
Metadata description of the output container (for the row) or map
(for map or repeated map.)
|
protected TupleMetadata |
schema
Internal writer schema that matches the column list.
|
loader, parentColumn, projectionSet, vectorCache
Modifier | Constructor and Description |
---|---|
protected |
TupleState(org.apache.drill.exec.physical.resultSet.impl.LoaderInternals events,
ResultVectorCache vectorCache,
ProjectionFilter projectionSet) |
Modifier and Type | Method and Description |
---|---|
protected void |
addColumn(ColumnState colState) |
ObjectWriter |
addColumn(TupleWriter tupleWriter,
ColumnMetadata columnSchema) |
ObjectWriter |
addColumn(TupleWriter tupleWriter,
MaterializedField column) |
abstract int |
addOutputColumn(ValueVector vector,
ColumnMetadata colSchema) |
protected void |
bindOutputSchema(TupleMetadata outputSchema) |
List<ColumnState> |
columns()
Returns an ordered set of the columns which make up the tuple.
|
protected Collection<ColumnState> |
columnStates() |
void |
dump(HierarchicalFormatter format) |
boolean |
hasProjections() |
boolean |
isProjected(String colName) |
TupleMetadata |
outputSchema() |
TupleMetadata |
schema() |
protected void |
updateOutput(int curSchemaVersion) |
abstract AbstractTupleWriter |
writer() |
addColumn, bindColumnState, close, harvestWithLookAhead, innerCardinality, isVersioned, loader, projection, rollover, startBatch, updateCardinality, vectorCache
protected final List<ColumnState> columns
protected final TupleMetadata schema
protected TupleMetadata outputSchema
Rows and maps have an output schema which may differ from the internal schema. The output schema excludes unprojected columns. It also excludes columns added in an overflow row.
The output schema is built slightly differently for maps inside a union vs. normal top-level (or nested) maps. Maps inside a union do not defer columns because of the muddy semantics (and infrequent use) of unions.
protected TupleState(org.apache.drill.exec.physical.resultSet.impl.LoaderInternals events, ResultVectorCache vectorCache, ProjectionFilter projectionSet)
protected void bindOutputSchema(TupleMetadata outputSchema)
public List<ColumnState> columns()
public TupleMetadata schema()
public abstract AbstractTupleWriter writer()
public boolean isProjected(String colName)
isProjected
in interface AbstractTupleWriter.TupleWriterListener
public ObjectWriter addColumn(TupleWriter tupleWriter, MaterializedField column)
addColumn
in interface AbstractTupleWriter.TupleWriterListener
public ObjectWriter addColumn(TupleWriter tupleWriter, ColumnMetadata columnSchema)
addColumn
in interface AbstractTupleWriter.TupleWriterListener
protected void addColumn(ColumnState colState)
addColumn
in class ContainerState
public boolean hasProjections()
protected Collection<ColumnState> columnStates()
columnStates
in class ContainerState
protected void updateOutput(int curSchemaVersion)
public abstract int addOutputColumn(ValueVector vector, ColumnMetadata colSchema)
public TupleMetadata outputSchema()
public void dump(HierarchicalFormatter format)
Copyright © 1970 The Apache Software Foundation. All rights reserved.