public class BuildFromSchema extends Object
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.
Modifier and Type | Method and Description |
---|---|
ObjectWriter |
buildColumn(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() |
public static BuildFromSchema instance()
public void buildTuple(TupleWriter writer, TupleMetadata schema)
schema
- desired tuple schema to be materializedpublic ObjectWriter buildColumn(TupleState state, ColumnMetadata colSchema)
state
- the loader state for the tuple, a row or a mapcolSchema
- the schema of the column to addpublic void buildUnion(VariantWriter writer, VariantMetadata schema)
Copyright © 1970 The Apache Software Foundation. All rights reserved.