Class MutableTupleSchema
java.lang.Object
org.apache.drill.exec.physical.impl.scan.v3.schema.MutableTupleSchema
A mutable form of a tuple schema. Allows insertions (at the wildcard position),
and replacing columns (as the schema becomes resolved). Tracks implicit columns
(those not filled in by the reader).
Does not implement the TupleMetadata
interface because that interface
has far more functionality than is needed here, and assumes that column order
remains fixed (and hence columns can be addressed by position) which is not
true for this class.
This class represents the top-level tuple (the row.) Maps are also dynamic, but provide a subset of resolution options: map fields cannot be implicit. They can, however, be defined, provided, discovered or missing. Map columns can start unresolved if the map comes from projection. A map itself can be resolved, but its members may be unresolved. New map members may only be added at the end (there is no equivalent of a wildcard position.)
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Holder for a column to allow inserting and replacing columns within the top-level project list. -
Field Summary
Modifier and TypeFieldDescriptionprotected final List<MutableTupleSchema.ColumnHandle>
protected final Map<String,
MutableTupleSchema.ColumnHandle> -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
add
(ColumnMetadata col) void
columns()
Provide the list of partially-resolved columns.void
copyFrom
(TupleMetadata from) insert
(int posn, ColumnMetadata col) insert
(ColumnMetadata col) boolean
isEmpty()
boolean
void
moveIfExplicit
(String colName) Move a column from its current position (which must be past the insert point) to the insert point.void
replace
(MutableTupleSchema.ColumnHandle col, ColumnMetadata resolved) void
resolve
(MutableTupleSchema.ColumnHandle col, ColumnMetadata resolved) void
resolveImplicit
(MutableTupleSchema.ColumnHandle col, ColumnMetadata resolved, ImplicitColumnMarker marker) void
setInsertPoint
(int insertPoint) void
int
size()
toSchema()
int
version()
-
Field Details
-
columns
-
nameIndex
-
-
Constructor Details
-
MutableTupleSchema
public MutableTupleSchema()
-
-
Method Details
-
setProjectionType
-
setInsertPoint
public void setInsertPoint(int insertPoint) -
projectionType
-
size
public int size() -
version
public int version() -
columns
Provide the list of partially-resolved columns. Primarily for the implicit column parser. -
find
-
copyFrom
-
add
-
addIndex
-
insert
-
insert
-
moveIfExplicit
Move a column from its current position (which must be past the insert point) to the insert point. An index entry already exists. Special operation done when matching a provided schema to a projection list that includes a wildcard and explicitly projected columns. Works around unfortunate behavior in the planner. -
isResolved
public boolean isResolved() -
toSchema
-
resolveImplicit
public void resolveImplicit(MutableTupleSchema.ColumnHandle col, ColumnMetadata resolved, ImplicitColumnMarker marker) -
replace
-
resolve
-
isEmpty
public boolean isEmpty()
-