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.

      Each name is a top-level field or the full dot-separated path to a nested field:

      • "id" - selects a top-level column
      • "address" - selects the parent group and all its children
      • "address.city" - selects only a specific nested field

      A nested field is reached by its full path only; "city" does not select address.city. Names may repeat or overlap, such as "address" and "address.city". For the order in which readers expose the projected columns by index, see the column projection reference.

      Parameters:
      names - the column names to project
      Returns:
      a projection containing only the specified columns
      Throws:
      IllegalArgumentException - if no column names are provided, or a name is null or empty
    • projectsAll

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

      public List<String> getProjectedColumnNames()
      Returns the column names to project, in the order they were requested and including repeats, or null if all columns are projected.