Class TupleSchema
java.lang.Object
org.apache.drill.exec.record.metadata.AbstractPropertied
org.apache.drill.exec.record.metadata.TupleSchema
- All Implemented Interfaces:
Iterable<ColumnMetadata>
,Propertied
,TupleMetadata
Defines the schema of a tuple: either the top-level row or a nested
"map" (really structure). A schema is a collection of columns (backed
by vectors in the loader itself.) Columns are accessible by name or
index. New columns may be added at any time; the new column takes the
next available index.
-
Field Summary
Fields inherited from interface org.apache.drill.exec.record.metadata.Propertied
DRILL_PROP_PREFIX
Fields inherited from interface org.apache.drill.exec.record.metadata.TupleMetadata
IS_STRICT_SCHEMA_PROP, READER, WRITER
-
Constructor Summary
ConstructorDescriptionTupleSchema
(List<AbstractColumnMetadata> columns, Map<String, String> properties) -
Method Summary
Modifier and TypeMethodDescriptionadd
(MaterializedField field) Add a new column to the schema.void
add
(ColumnMetadata md) Add a column metadata column created by the caller.int
addColumn
(ColumnMetadata column) addView
(MaterializedField field) void
bind
(AbstractMapColumnMetadata parentMap) column
(int index) copy()
boolean
fullName()
fullName
(int index) fullName
(ColumnMetadata column) Full name of the column.int
hashCode()
int
boolean
isEmpty()
boolean
isEquivalent
(TupleMetadata other) boolean
isRoot()
iterator()
metadata
(int index) parent()
void
replace
(ColumnMetadata replaceWith) int
size()
Return the schema as a list of MaterializedField objects which can be used to create other schemas.Returns schema as list of ColumnMetadata objects which can be used to create JSON schema object.toString()
Methods inherited from class org.apache.drill.exec.record.metadata.AbstractPropertied
booleanProperty, booleanProperty, hasProperties, intProperty, intProperty, property, property, removeProperty, setBooleanProperty, setIntProperty, setProperties, setProperty
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
Methods inherited from interface org.apache.drill.exec.record.metadata.Propertied
booleanProperty, booleanProperty, hasProperties, intProperty, intProperty, property, property, removeProperty, setBooleanProperty, setIntProperty, setProperties, setProperty
Methods inherited from interface org.apache.drill.exec.record.metadata.TupleMetadata
jsonString
-
Field Details
-
TYPE
- See Also:
-
-
Constructor Details
-
TupleSchema
public TupleSchema() -
TupleSchema
-
-
Method Details
-
bind
-
copy
- Specified by:
copy
in interfaceTupleMetadata
-
add
Description copied from interface:TupleMetadata
Add a new column to the schema.- Specified by:
add
in interfaceTupleMetadata
- Parameters:
field
- materialized field- Returns:
- the index of the new column
-
addView
-
add
Add a column metadata column created by the caller. Used for specialized cases beyond those handled byadd(MaterializedField)
.- Parameters:
md
- the custom column metadata which must have the correct index set (fromsize()
-
addColumn
- Specified by:
addColumn
in interfaceTupleMetadata
-
column
- Specified by:
column
in interfaceTupleMetadata
-
metadata
- Specified by:
metadata
in interfaceTupleMetadata
-
index
- Specified by:
index
in interfaceTupleMetadata
-
column
- Specified by:
column
in interfaceTupleMetadata
-
metadata
- Specified by:
metadata
in interfaceTupleMetadata
-
parent
- Specified by:
parent
in interfaceTupleMetadata
-
size
public int size()- Specified by:
size
in interfaceTupleMetadata
-
isEmpty
public boolean isEmpty()- Specified by:
isEmpty
in interfaceTupleMetadata
-
iterator
- Specified by:
iterator
in interfaceIterable<ColumnMetadata>
-
isEquivalent
- Specified by:
isEquivalent
in interfaceTupleMetadata
-
equals
- Overrides:
equals
in classAbstractPropertied
-
hashCode
public int hashCode()- Overrides:
hashCode
in classAbstractPropertied
-
toFieldList
Description copied from interface:TupleMetadata
Return the schema as a list of MaterializedField objects which can be used to create other schemas. Not valid for a flattened schema.- Specified by:
toFieldList
in interfaceTupleMetadata
- Returns:
- a list of the top-level fields. Maps contain their child fields
-
toMetadataList
Description copied from interface:TupleMetadata
Returns schema as list of ColumnMetadata objects which can be used to create JSON schema object.- Specified by:
toMetadataList
in interfaceTupleMetadata
- Returns:
- a list of metadata for each column
-
fullName
- Specified by:
fullName
in interfaceTupleMetadata
-
fullName
Description copied from interface:TupleMetadata
Full name of the column. Note: this name cannot be used to look up the column because of ambiguity. The name "a.b.c" may mean a single column with that name, or may mean maps "a", and "b" with column "c", etc.- Specified by:
fullName
in interfaceTupleMetadata
- Returns:
- full, dotted, column name
-
fullName
-
isRoot
public boolean isRoot() -
replace
- Specified by:
replace
in interfaceTupleMetadata
-
toString
-
properties
- Specified by:
properties
in interfacePropertied
- Overrides:
properties
in classAbstractPropertied
-