Class BuildFromSchema
Recursion is much easier if we can go bottom-up. But, writers require top-down construction.
This particular class builds a column and all its contents. For example, given a map, which contains a repeated list which contains a repeated INT, this class first builds the map, then adds the repeated list, then adds the INT array. To do so, it will create a copy of the structured metadata.
A drawback of this approach is that the metadata objects used in the "parent" writers will be copies of, not the same as, those in the schema from which we are building the writers. At present, this is not an issue, but it is something to be aware of as uses become more sophisticated.
This class contrasts with the @{link ColumnBuilder} class which builds the structure within a single vector and writer.
-
Method Summary
Modifier and TypeMethodDescriptionbuildColumn
(TupleState state, ColumnMetadata colSchema) Build a column recursively.void
buildTuple
(TupleWriter writer, TupleMetadata schema) When creating a schema up front, provide the schema of the desired tuple, then build vectors and writers to match.void
buildUnion
(VariantWriter writer, VariantMetadata schema) static BuildFromSchema
instance()
-
Method Details
-
instance
-
buildTuple
When creating a schema up front, provide the schema of the desired tuple, then build vectors and writers to match. Allows up-front schema definition in addition to on-the-fly schema creation handled elsewhere.- Parameters:
schema
- desired tuple schema to be materialized
-
buildColumn
Build a column recursively. Called internally when adding a column via the addColumn() method on the tuple writer.- Parameters:
state
- the loader state for the tuple, a row or a mapcolSchema
- the schema of the column to add- Returns:
- the object writer for the added column
-
buildUnion
-