Class TupleState.MapColumnState
java.lang.Object
org.apache.drill.exec.physical.resultSet.impl.ColumnState
org.apache.drill.exec.physical.resultSet.impl.ColumnState.BaseContainerColumnState
org.apache.drill.exec.physical.resultSet.impl.TupleState.MapColumnState
- Enclosing class:
- TupleState
Represents a map column (either single or repeated). Includes maps that
are top-level, nested within other maps, or nested inside a union.
Schema management is a bit complex:
Condition | Action | |
---|---|---|
Outside of Union | Inside of Union | |
Unprojected | N/A | Omitted from output |
Added in prior batch | Included in output | |
Added in present batch, before overflow | Included in output | |
Added in present batch, after overflow | Omitted from output this batch (added next batch) | Included in output |
The above rules say that, for maps in a union, the output schema is identical to the internal writer schema. But, for maps outside of union, the output schema is a subset of the internal schema with two types of omissions:
- Unprojected columns
- Columns added after overflow </ul
New columns can be added at any time for data readers that discover their schema as data is read (such as JSON). In this case, new columns always appear at the end of the map (remember, in Drill, a "map" is actually a structured: an ordered, named list of columns.) When looking for newly added columns, they will always be at the end.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.drill.exec.physical.resultSet.impl.ColumnState
ColumnState.BaseContainerColumnState, ColumnState.PrimitiveColumnState, ColumnState.State
-
Field Summary
Modifier and TypeFieldDescriptionprotected boolean
protected final TupleState.MapState
protected final ColumnMetadata
Fields inherited from class org.apache.drill.exec.physical.resultSet.impl.ColumnState
addVersion, cardinality, loader, outputIndex, state, vectorState, writer
-
Constructor Summary
ConstructorDescriptionMapColumnState
(TupleState.MapState mapState, AbstractObjectWriter writer, VectorState vectorState, boolean isVersioned) -
Method Summary
Methods inherited from class org.apache.drill.exec.physical.resultSet.impl.ColumnState.BaseContainerColumnState
close, harvestWithLookAhead, rollover, startBatch, updateCardinality
Methods inherited from class org.apache.drill.exec.physical.resultSet.impl.ColumnState
allocateVectors, buildOutput, dump, innerCardinality, outerCardinality, schema, vector, vectorState, writer
-
Field Details
-
mapState
-
isVersioned
protected boolean isVersioned -
outputSchema
-
-
Constructor Details
-
MapColumnState
public MapColumnState(TupleState.MapState mapState, AbstractObjectWriter writer, VectorState vectorState, boolean isVersioned)
-
-
Method Details
-
mapState
-
container
- Specified by:
container
in classColumnState.BaseContainerColumnState
-
isProjected
public boolean isProjected()- Overrides:
isProjected
in classColumnState
-
isVersioned
public boolean isVersioned()Indicate if this map is versioned. A versionable map has three attributes:- Columns can be unprojected. (Columns appear as writers for the client of the result set loader, but are not materialized and do not appear in the projected output container.
- Columns appear in the output only if added before the overflow row.
- As a result, the output schema is a subset of the internal input schema.
- Returns:
- true if this map is versioned as described above
-
outputSchema
- Specified by:
outputSchema
in classColumnState
-