Class VariantSchema
java.lang.Object
org.apache.drill.exec.record.metadata.VariantSchema
- All Implemented Interfaces:
VariantMetadata
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addList
(VariantColumnMetadata listCol) void
addMap
(MapColumnMetadata mapCol) addType
(TypeProtos.MinorType type) Add any supported type to the variant.addType
(MaterializedField field) void
addType
(ColumnMetadata col) Add a column for any supported type to the variant.void
protected void
bind
(VariantColumnMetadata parent) copy()
boolean
hasType
(TypeProtos.MinorType type) Determine if the given type is a member of the variant.boolean
isEquivalent
(VariantSchema other) boolean
isSimple()
boolean
A list is defined as a list of variants at the metadata layer.Lists are odd creatures: they contain a union if they have more than one subtype, but are like a nullable repeated type if they contain only one type.member
(TypeProtos.MinorType type) Retrieve the virtual column for a given type.static ColumnMetadata
members()
parent()
Return the column that defines this variant structureint
size()
Returns the number of types in the variant.toString()
types()
Returns the list of types which are members of this variant.
-
Constructor Details
-
VariantSchema
public VariantSchema()
-
-
Method Details
-
bind
-
memberMetadata
-
addType
Description copied from interface:VariantMetadata
Add any supported type to the variant.At present, the union vector does not support the decimal types. This class does not reject such types; but they will cause a runtime exception when code asks the union vector for these types.
- Specified by:
addType
in interfaceVariantMetadata
- Parameters:
type
- type to add- Returns:
- the "virtual" column for that type
-
addType
Description copied from interface:VariantMetadata
Add a column for any supported type to the variant. Use this to add structure to a list or map member.- Specified by:
addType
in interfaceVariantMetadata
- Parameters:
col
- column to add. The column must have the correct mode. The column's type is used as the type key
-
size
public int size()Description copied from interface:VariantMetadata
Returns the number of types in the variant.- Specified by:
size
in interfaceVariantMetadata
- Returns:
- the number of types in the variant
-
hasType
Description copied from interface:VariantMetadata
Determine if the given type is a member of the variant.- Specified by:
hasType
in interfaceVariantMetadata
- Parameters:
type
- type to check- Returns:
- true if the type is a member, false if not
-
member
Description copied from interface:VariantMetadata
Retrieve the virtual column for a given type.- Specified by:
member
in interfaceVariantMetadata
- Parameters:
type
- the type key- Returns:
- the virtual column, or null if the type is not a member of the variant
-
parent
Description copied from interface:VariantMetadata
Return the column that defines this variant structure- Specified by:
parent
in interfaceVariantMetadata
- Returns:
- the column that returns this variant structure
from its
variantSchema()
method
-
types
Description copied from interface:VariantMetadata
Returns the list of types which are members of this variant.- Specified by:
types
in interfaceVariantMetadata
- Returns:
- the list of types
-
members
- Specified by:
members
in interfaceVariantMetadata
-
addMap
-
addList
-
addType
-
isSingleType
public boolean isSingleType()Description copied from interface:VariantMetadata
A list is defined as a list of variants at the metadata layer. But, in implementation, a list will do special processing if the variant (union) contains only one type.- Specified by:
isSingleType
in interfaceVariantMetadata
- Returns:
- true if this variant contains only one type, false if the variant contains 0, 2 or more types
-
listSubtype
Description copied from interface:VariantMetadata
Lists are odd creatures: they contain a union if they have more than one subtype, but are like a nullable repeated type if they contain only one type. This method returns the type of the array: either the single type (ifVariantMetadata.isSingleType()
is true) or a reference to the synthetic union column nested inside the list.- Specified by:
listSubtype
in interfaceVariantMetadata
- Returns:
- the metadata for the implicit column within the list
-
becomeSimple
public void becomeSimple()- Specified by:
becomeSimple
in interfaceVariantMetadata
-
isSimple
public boolean isSimple()- Specified by:
isSimple
in interfaceVariantMetadata
-
toString
-
cloneEmpty
-
copy
-
isEquivalent
-