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
FieldsFields inherited from interface org.apache.drill.exec.record.metadata.Propertied
DRILL_PROP_PREFIXFields inherited from interface org.apache.drill.exec.record.metadata.TupleMetadata
IS_STRICT_SCHEMA_PROP, READER, WRITER -
Constructor Summary
ConstructorsConstructorDescriptionTupleSchema(List<AbstractColumnMetadata> columns, Map<String, String> properties) -
Method Summary
Modifier and TypeMethodDescriptionadd(MaterializedField field) Add a new column to the schema.voidadd(ColumnMetadata md) Add a column metadata column created by the caller.intaddColumn(ColumnMetadata column) addView(MaterializedField field) voidbind(AbstractMapColumnMetadata parentMap) column(int index) copy()booleanfullName()fullName(int index) fullName(ColumnMetadata column) Full name of the column.inthashCode()intbooleanisEmpty()booleanisEquivalent(TupleMetadata other) booleanisRoot()iterator()metadata(int index) parent()voidreplace(ColumnMetadata replaceWith) intsize()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, setPropertyMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliteratorMethods inherited from interface org.apache.drill.exec.record.metadata.Propertied
booleanProperty, booleanProperty, hasProperties, intProperty, intProperty, property, property, removeProperty, setBooleanProperty, setIntProperty, setProperties, setPropertyMethods 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:
copyin interfaceTupleMetadata
-
add
Description copied from interface:TupleMetadataAdd a new column to the schema.- Specified by:
addin 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:
addColumnin interfaceTupleMetadata
-
column
- Specified by:
columnin interfaceTupleMetadata
-
metadata
- Specified by:
metadatain interfaceTupleMetadata
-
index
- Specified by:
indexin interfaceTupleMetadata
-
column
- Specified by:
columnin interfaceTupleMetadata
-
metadata
- Specified by:
metadatain interfaceTupleMetadata
-
parent
- Specified by:
parentin interfaceTupleMetadata
-
size
public int size()- Specified by:
sizein interfaceTupleMetadata
-
isEmpty
public boolean isEmpty()- Specified by:
isEmptyin interfaceTupleMetadata
-
iterator
- Specified by:
iteratorin interfaceIterable<ColumnMetadata>
-
isEquivalent
- Specified by:
isEquivalentin interfaceTupleMetadata
-
equals
- Overrides:
equalsin classAbstractPropertied
-
hashCode
public int hashCode()- Overrides:
hashCodein classAbstractPropertied
-
toFieldList
Description copied from interface:TupleMetadataReturn the schema as a list of MaterializedField objects which can be used to create other schemas. Not valid for a flattened schema.- Specified by:
toFieldListin interfaceTupleMetadata- Returns:
- a list of the top-level fields. Maps contain their child fields
-
toMetadataList
Description copied from interface:TupleMetadataReturns schema as list of ColumnMetadata objects which can be used to create JSON schema object.- Specified by:
toMetadataListin interfaceTupleMetadata- Returns:
- a list of metadata for each column
-
fullName
- Specified by:
fullNamein interfaceTupleMetadata
-
fullName
Description copied from interface:TupleMetadataFull 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:
fullNamein interfaceTupleMetadata- Returns:
- full, dotted, column name
-
fullName
-
isRoot
public boolean isRoot() -
replace
- Specified by:
replacein interfaceTupleMetadata
-
toString
-
properties
- Specified by:
propertiesin interfacePropertied- Overrides:
propertiesin classAbstractPropertied
-