Class BaseFieldFactory
java.lang.Object
org.apache.drill.exec.store.easy.json.loader.BaseFieldFactory
- All Implemented Interfaces:
FieldFactory
- Direct Known Subclasses:
ExtendedTypeFieldFactory
,InferredFieldFactory
,ProvidedFieldFactory
Base field factor class which handles the common tasks for
building column writers and JSON listeners.
-
Field Summary
-
Constructor Summary
ConstructorDescriptionBaseFieldFactory
(JsonLoaderImpl loader) BaseFieldFactory
(JsonLoaderImpl loader, FieldFactory child) -
Method Summary
Modifier and TypeMethodDescriptionbuildOuterArrays
(ObjectWriter writer, int dims, Function<ObjectWriter, ElementParser> innerCreator) Create layers of repeated list listeners around the type-specific array.forceArrayResolution
(FieldDefn fieldDefn) forceNullResolution
(FieldDefn fieldDefn) protected JsonLoaderImpl
loader()
multiDimObjectArrayFor
(ObjectWriter writer, int dims, TupleMetadata providedSchema) Create a repeated list listener for a Map.protected ElementParser
multiDimScalarArrayFor
(ObjectWriter writer, int dims) Create a repeated list listener for a scalar value.protected ElementParser
multiDimVariantArrayParserFor
(ObjectWriter writer, int dims) Create a repeated list listener for a variant.protected ElementParser
objectArrayParserFor
(FieldDefn fieldDefn, ColumnMetadata colSchema, TupleMetadata providedSchema) Create a map array column and its associated parsers and listeners for the given column schema and optional provided schema.protected ElementParser
objectArrayParserFor
(ArrayWriter arrayWriter, TupleMetadata providedSchema) objectParserFor
(FieldDefn fieldDefn) Create a map column and its associated object value listener for the a JSON object value given the value's key.protected ElementParser
objectParserFor
(FieldDefn fieldDefn, ColumnMetadata colSchema, TupleMetadata providedSchema) Create a map column and its associated object value listener for the given key and optional provided schema.protected ElementParser
objectParserFor
(TupleWriter writer, TupleMetadata providedSchema) protected FieldParserFactory
protected ColumnMetadata
repeatedListSchemaFor
(String key, int dims, ColumnMetadata innerArray) Build up a repeated list column definition given a specification of the number of dimensions and the JSON type.protected ElementParser
scalarArrayParserFor
(ValueParser element) protected ElementParser
scalarArrayParserFor
(ArrayWriter writer) scalarListenerFor
(ScalarWriter writer) scalarParserFor
(FieldDefn fieldDefn, ColumnMetadata colSchema) Internal method which allows a custom parser (such as for extended types) to provide the scalar parser for a provided schema.scalarParserFor
(ScalarWriter writer) protected ElementParser
variantArrayParserFor
(ArrayWriter arrayWriter) Create a variant array (LIST) column and its associated parser given a column schema.protected ElementParser
variantParserFor
(VariantWriter writer) Create a variant (UNION) column and its associated parser given a column schema.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.apache.drill.exec.store.easy.json.loader.FieldFactory
fieldParser
-
Field Details
-
loader
-
child
-
-
Constructor Details
-
BaseFieldFactory
-
BaseFieldFactory
-
-
Method Details
-
parserFactory
-
ignoredFieldParser
- Specified by:
ignoredFieldParser
in interfaceFieldFactory
-
loader
-
scalarParserFor
Description copied from interface:FieldFactory
Internal method which allows a custom parser (such as for extended types) to provide the scalar parser for a provided schema.- Specified by:
scalarParserFor
in interfaceFieldFactory
-
scalarParserFor
-
scalarArrayParserFor
-
scalarArrayParserFor
-
multiDimScalarArrayFor
Create a repeated list listener for a scalar value. -
objectParserFor
Create a map column and its associated object value listener for the a JSON object value given the value's key. -
objectParserFor
protected ElementParser objectParserFor(FieldDefn fieldDefn, ColumnMetadata colSchema, TupleMetadata providedSchema) Create a map column and its associated object value listener for the given key and optional provided schema. -
objectArrayParserFor
protected ElementParser objectArrayParserFor(FieldDefn fieldDefn, ColumnMetadata colSchema, TupleMetadata providedSchema) Create a map array column and its associated parsers and listeners for the given column schema and optional provided schema. -
objectArrayParserFor
-
objectParserFor
-
multiDimObjectArrayFor
public ElementParser multiDimObjectArrayFor(ObjectWriter writer, int dims, TupleMetadata providedSchema) Create a repeated list listener for a Map. -
variantParserFor
Create a variant (UNION) column and its associated parser given a column schema. -
variantArrayParserFor
Create a variant array (LIST) column and its associated parser given a column schema. -
multiDimVariantArrayParserFor
Create a repeated list listener for a variant. Here, the inner array is provided by a List (which is a repeated Union.) -
buildOuterArrays
public ElementParser buildOuterArrays(ObjectWriter writer, int dims, Function<ObjectWriter, ElementParser> innerCreator) Create layers of repeated list listeners around the type-specific array. If the JSON has three array levels, the outer two are repeated lists, the inner is type-specific: say an array ofBIGINT
or a map array. -
repeatedListSchemaFor
Build up a repeated list column definition given a specification of the number of dimensions and the JSON type. Creation of the element type is via a closure that builds the needed schema. -
scalarListenerFor
-
forceNullResolution
- Specified by:
forceNullResolution
in interfaceFieldFactory
-
forceArrayResolution
- Specified by:
forceArrayResolution
in interfaceFieldFactory
-