Class FileSchema
java.lang.Object
dev.hardwood.schema.FileSchema
Root schema container representing the complete Parquet schema.
Supports both flat schemas and nested structures (structs, lists).
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classBuilder for constructing aFileSchemaprogrammatically.static final classDeclares the element of aLIST, or the value of aMAP: a primitive, a nestedstruct, a nestedLIST, or a nestedMAP.static final classDeclares the fields of astructgroup. -
Method Summary
Modifier and TypeMethodDescriptionstatic FileSchema.BuilderCreates a builder for constructing a flat schema programmatically, for use with the writer.static FileSchemafromSchemaElements(List<SchemaElement> elements) Reconstruct schema from Thrift SchemaElement list.getColumn(int index) Returns the column at the given zero-based index.Returns the column with the given field path.Returns the column with the given name or dot-separated path.intReturns the total number of leaf columns in this schema.Returns an unmodifiable list of all leaf columns in schema order.Finds a top-level field by name in the schema tree.getName()Returns the schema name (typically "schema" or "message").Returns the hierarchical schema tree representation.booleanReturns true if this schema supports direct columnar access.Flattens this schema back into the depth-firstSchemaElementlist written to the file footer, the inverse offromSchemaElements(List): the root element followed by each node in pre-order, groups carrying their child count.toString()
-
Method Details
-
getName
Returns the schema name (typically "schema" or "message"). -
getColumns
Returns an unmodifiable list of all leaf columns in schema order. -
getColumn
Returns the column at the given zero-based index.- Parameters:
index- zero-based column index
-
getColumn
Returns the column with the given name or dot-separated path.
For flat schemas, the name is the column name (e.g.
"passenger_count"). For nested schemas, use the dot-separated field path (e.g."address.zip") to avoid ambiguity when multiple nested columns share a leaf name.- Parameters:
name- column name or dot-separated field path- Throws:
IllegalArgumentException- if no column with the given name exists
-
getColumn
Returns the column with the given field path.- Parameters:
fieldPath- path from schema root to leaf column- Throws:
IllegalArgumentException- if no column with the given path exists
-
getColumnCount
public int getColumnCount()Returns the total number of leaf columns in this schema. -
getRootNode
Returns the hierarchical schema tree representation. -
getField
Finds a top-level field by name in the schema tree. -
isFlatSchema
public boolean isFlatSchema()Returns true if this schema supports direct columnar access. For such schemas, enabling direct columnar access without record assembly.
A schema supports columnar access if all top-level fields are primitives (no nested structs, lists, or maps) and no columns have repetition.
-
builder
Creates a builder for constructing a flat schema programmatically, for use with the writer.- Parameters:
name- the schema (message) name, conventionally"schema"
-
toSchemaElements
Flattens this schema back into the depth-firstSchemaElementlist written to the file footer, the inverse offromSchemaElements(List): the root element followed by each node in pre-order, groups carrying their child count. -
fromSchemaElements
Reconstruct schema from Thrift SchemaElement list. -
toString
-