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:
-
Method Summary
Modifier and TypeMethodDescriptionstatic 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.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.
-
fromSchemaElements
Reconstruct schema from Thrift SchemaElement list. -
toString
-