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
ConstructorDescriptionDictBuilder
(org.apache.drill.exec.record.metadata.SchemaContainer parent, String name, TypeProtos.DataMode mode) -
Method Summary
Modifier and TypeMethodDescriptionvoid
addColumn
(ColumnMetadata column) void
build()
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.VARDECIMAL
with scale and precision orTypeProtos.MinorType.VARCHAR
etc.- Parameters:
type
- desired type for key- Returns:
this
builder- Throws:
IllegalStateException
- if key field is already setIllegalArgumentException
- iftype
is 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:
this
builder- Throws:
IllegalStateException
- if value is already setIllegalArgumentException
- iftype
is eitherMAP
,LIST
,DICT
orUNION
.- See Also:
-
mapValue
-
mapArrayValue
-
dictValue
-
dictArrayValue
-
unionValue
-
listValue
-
repeatedListValue
-
buildColumn
-
build
public void build() -
resumeSchema
-
resumeMap
-
resumeList
-
resumeUnion
-
resumeDict
-