Class FileSchema

java.lang.Object
dev.hardwood.schema.FileSchema

public class FileSchema extends Object
Root schema container representing the complete Parquet schema. Supports both flat schemas and nested structures (structs, lists).
See Also:
  • Method Details

    • getName

      public String getName()
      Returns the schema name (typically "schema" or "message").
    • getColumns

      public List<ColumnSchema> getColumns()
      Returns an unmodifiable list of all leaf columns in schema order.
    • getColumn

      public ColumnSchema getColumn(int index)
      Returns the column at the given zero-based index.
      Parameters:
      index - zero-based column index
    • getColumn

      public ColumnSchema getColumn(String name)

      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

      public ColumnSchema getColumn(FieldPath fieldPath)
      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

      public SchemaNode.GroupNode getRootNode()
      Returns the hierarchical schema tree representation.
    • getField

      public SchemaNode getField(String name)
      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

      public static FileSchema fromSchemaElements(List<SchemaElement> elements)
      Reconstruct schema from Thrift SchemaElement list.
    • toString

      public String toString()
      Overrides:
      toString in class Object