Skip to content

Filtering on a struct field that an older file lacks raises FieldNotFound #7658

Open

Description

@RyanLin5967

Describe the bug

Currently, when a Parquet file's struct column is missing a field that the scan schema has, a filter on that field fails while reading the file. substitute_missing_cols (src/daft-parquet/src/helpers.rs) replaces a missing top-level column with NULL before the predicate is bound to the file's schema, but a missing struct field is not a top-level column, so col("s")["y"] is bound against the file's s: struct<x> and raises FieldNotFound. Selecting the same field works and returns NULL for that file. This is what a struct looks like after an Iceberg add_column(("s", "y"), ...) or a Delta schema_mode="merge" write, so read_iceberg and read_deltalake fail on the same filter.

To Reproduce

import daft, pyarrow as pa, pyarrow.parquet as pq

pq.write_table(pa.table({"id": [1], "s": [{"x": 1, "y": "q"}]}), "new.parquet")
pq.write_table(pa.table({"id": [2], "s": [{"x": 2}]}), "old.parquet")

df = daft.read_parquet(["new.parquet", "old.parquet"])
print(df.select(df["s"]["y"]).to_pydict())
# {'y': ['q', None]}
print(df.where(df["s"]["y"].is_null()).to_pydict())
# daft.exceptions.DaftCoreException: DaftError::FieldNotFound Field y not found in schema: ["x"]

Expected behavior

{'id': [2], 's': [{'x': 2, 'y': None}]}, the row whose s.y the unfiltered read returns as NULL.

Component(s)

Data Sources & Sinks

Additional context

daft 0.7.26, pyarrow 25.0.1, Python 3.12.13, macOS 26.6.2, arm64 (Darwin 25.6.0). On main, substitute_missing_cols still only matches Expr::Column. #6551 (for #6550) fixed this for top-level columns added by schema evolution; a field added inside a struct still fails.

daft.read_iceberg after update_schema().add_column(("s", "y"), StringType()) and daft.read_deltalake after a schema_mode="merge" append that adds s.y raise the same error for s.y IS NULL and s.y = 'q'; PyIceberg, polars, DuckDB and deltalake return the matching rows.

Activity

  1. added
    bug
    on Oct 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugneeds triage

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions