Skip to main content

build_projection_plan

Function build_projection_plan 

Source
pub(crate) fn build_projection_plan(
    parquet_read_cols: &ParquetReadColumns,
    parquet_schema_desc: &SchemaDescriptor,
    source_schema: &Schema,
) -> Result<ProjectionMaskPlan>
Expand description

Builds a projection mask plan for reading a parquet file.

parquet_read_cols defines the requested root columns and optional nested paths to read.

parquet_schema_desc is the schema descriptor of the current parquet file. It is used to resolve requested nested paths to actual leaf column indices.

source_schema is the Arrow schema of the current parquet file. It is used only for nested projections to identify JSON2 root fields.

See ProjectionMaskPlan for the returned value.

For example, if the query requests j.a and k, but the current parquet file only contains leaves under j.b and k, then the returned plan keeps k in the projection mask and marks j as not present in the output, so it can be synthesized during post-processing.