Class VariantSchema
java.lang.Object
org.apache.drill.exec.record.metadata.VariantSchema
- All Implemented Interfaces:
VariantMetadata
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddList(VariantColumnMetadata listCol) voidaddMap(MapColumnMetadata mapCol) addType(TypeProtos.MinorType type) Add any supported type to the variant.addType(MaterializedField field) voidaddType(ColumnMetadata col) Add a column for any supported type to the variant.voidprotected voidbind(VariantColumnMetadata parent) copy()booleanhasType(TypeProtos.MinorType type) Determine if the given type is a member of the variant.booleanisEquivalent(VariantSchema other) booleanisSimple()booleanA 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 ColumnMetadatamembers()parent()Return the column that defines this variant structureintsize()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:VariantMetadataAdd 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:
addTypein interfaceVariantMetadata- Parameters:
type- type to add- Returns:
- the "virtual" column for that type
-
addType
Description copied from interface:VariantMetadataAdd a column for any supported type to the variant. Use this to add structure to a list or map member.- Specified by:
addTypein 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:VariantMetadataReturns the number of types in the variant.- Specified by:
sizein interfaceVariantMetadata- Returns:
- the number of types in the variant
-
hasType
Description copied from interface:VariantMetadataDetermine if the given type is a member of the variant.- Specified by:
hasTypein interfaceVariantMetadata- Parameters:
type- type to check- Returns:
- true if the type is a member, false if not
-
member
Description copied from interface:VariantMetadataRetrieve the virtual column for a given type.- Specified by:
memberin 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:VariantMetadataReturn the column that defines this variant structure- Specified by:
parentin interfaceVariantMetadata- Returns:
- the column that returns this variant structure
from its
variantSchema()method
-
types
Description copied from interface:VariantMetadataReturns the list of types which are members of this variant.- Specified by:
typesin interfaceVariantMetadata- Returns:
- the list of types
-
members
- Specified by:
membersin interfaceVariantMetadata
-
addMap
-
addList
-
addType
-
isSingleType
public boolean isSingleType()Description copied from interface:VariantMetadataA 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:
isSingleTypein 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:VariantMetadataLists 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:
listSubtypein interfaceVariantMetadata- Returns:
- the metadata for the implicit column within the list
-
becomeSimple
public void becomeSimple()- Specified by:
becomeSimplein interfaceVariantMetadata
-
isSimple
public boolean isSimple()- Specified by:
isSimplein interfaceVariantMetadata
-
toString
-
cloneEmpty
-
copy
-
isEquivalent
-