Class ColumnProjection

java.lang.Object
dev.hardwood.schema.ColumnProjection

public final class ColumnProjection extends Object
Specifies which columns to read from a Parquet file.

Column projection allows reading only a subset of columns, improving performance by skipping I/O, decoding, and memory allocation for unneeded columns.

Usage examples:

// Read all columns (default)
ColumnProjection.all()

// Read specific columns
ColumnProjection.columns("id", "name", "address")

// For nested schemas, dot notation selects nested fields
ColumnProjection.columns("address.city")  // specific nested field
ColumnProjection.columns("address")       // parent group and all children
  • Method Details

    • all

      public static ColumnProjection all()
      Returns a projection that includes all columns.
    • columns

      public static ColumnProjection columns(String... names)
      Returns a projection that includes only the specified columns.

      For flat schemas, use simple column names. For nested schemas:

      • "address" - selects the parent group and all its children
      • "address.city" - selects only a specific nested field
      Parameters:
      names - the column names to project
      Returns:
      a projection containing only the specified columns
      Throws:
      IllegalArgumentException - if no column names are provided
    • projectsAll

      public boolean projectsAll()
      Returns true if this projection includes all columns.
    • getProjectedColumnNames

      public Set<String> getProjectedColumnNames()
      Returns the set of column names to project, or null if all columns are projected.