Class DictBuilder
java.lang.Object
org.apache.drill.exec.record.metadata.DictBuilder
Internal structure for building a dict. Dict is an array of key-value pairs
with defined types for key and value (key and value fields are defined within
TupleSchema).
Key can be TypeProtos.DataMode.REQUIRED primitive,
while value can be primitive or complex.
Column is added to the parent container during creation and all resumeXXX methods return qualified parent container.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionDictBuilder(org.apache.drill.exec.record.metadata.SchemaContainer parent, String name, TypeProtos.DataMode mode) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddColumn(ColumnMetadata column) voidbuild()key(TypeProtos.MajorType type) Use this method to set types with width or scale and precision, e.g.key(TypeProtos.MinorType type) mapValue()value(TypeProtos.MajorType type) Define non-complex value type.value(TypeProtos.MinorType type)
-
Constructor Details
-
DictBuilder
public DictBuilder(org.apache.drill.exec.record.metadata.SchemaContainer parent, String name, TypeProtos.DataMode mode)
-
-
Method Details
-
addColumn
-
key
-
key
Use this method to set types with width or scale and precision, e.g.TypeProtos.MinorType.VARDECIMALwith scale and precision orTypeProtos.MinorType.VARCHARetc.- Parameters:
type- desired type for key- Returns:
thisbuilder- Throws:
IllegalStateException- if key field is already setIllegalArgumentException- iftypeis not supported (either complex or nullable)
-
value
-
nullableValue
-
repeatedValue
-
value
Define non-complex value type. For complex types usemapValue(),mapArrayValue()etc.- Parameters:
type- desired non-complex type for value.- Returns:
thisbuilder- Throws:
IllegalStateException- if value is already setIllegalArgumentException- iftypeis eitherMAP,LIST,DICTorUNION.- See Also:
-
mapValue
-
mapArrayValue
-
dictValue
-
dictArrayValue
-
unionValue
-
listValue
-
repeatedListValue
-
buildColumn
-
build
public void build() -
resumeSchema
-
resumeMap
-
resumeList
-
resumeUnion
-
resumeDict
-