Skip to content

[EPIC] Improvements to struct access in Parquet #24119

Description

@adriangb

This EPIC tracks work on making queries over struct columns in Parquet read and evaluate only what they need — projection pruning, filter pushdown, row-group pruning, and the statistics that feed them.

Scope is the concrete Parquet-side machinery: datafusion/datasource-parquet/src/{projection_read_plan,row_filter,nested_schema_pruning}.rs and the physical expression adapter's interaction with it. Variant support builds on some of the same primitives but is tracked separately in #21308.

Motivation

Two shapes reach the Parquet scan for struct access, and they are handled by unrelated code:

  1. get_field expressionsWHERE s['x'] = 200, SELECT s['a']. Handled by PushdownChecker / StructFieldAccess.
  2. A narrowed declared schema — the table declares s STRUCT<a> where the file has STRUCT<a, b, c>. The physical expression adapter rewrites the projected column into CAST(s AS STRUCT<a>), and engines like Spark/Comet communicate nested projection pruning this way, as a clipped read schema rather than as expressions.

Until #24090, shape (2) read every physical leaf and discarded the extras in memory. apache/datafusion-comet#4859 reported a production query reading 1.35 TB where plain Spark read 30.9 GB for the same pruned ReadSchema. Any embedder that hands DataFusion a pre-pruned schema — Comet, delta-rs, Iceberg integrations — hits the same gap.

#24090 fixes that for the projection path. The items below are what it does not cover.

Note that the cast side of shape (2) is already settled: CastColumnExpr was removed in 54.0.0 (#21563) and struct-aware casting is unified into the field-aware CastExpr, which routes through nested_struct::cast_column via ColumnarValue::cast_to. That single cast node is what nested pruning clips against.

Correctness

Projection & filter pruning

Row-group pruning & statistics

Schema evolution

Shared with Variant

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    EPICA larger project, actively underway, with sub tasksdatasourceChanges to the datasource crateenhancementNew feature or requestperformanceMake DataFusion faster

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions