Repository navigation
fix(parquet): treat a struct field missing from the file as null in pushed-down filters - #7669
Conversation
…ushed-down filters Fixes Eventual-Inc#7658 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Signed-off-by: Alex Castillo <alex.castillog33@gmail.com>
[Medium impact] The change affects predicate handling in Parquet reads. Fix constant mask lengths before merging so missing-field filters work for multi-row reads. Findings
SummaryExtends
Reviews (1) · Last reviewed commit: "fix(parquet): treat a struct field missi..." · Reviewed by Greptile |
| if missing { | ||
| return Ok(Transformed::yes(null_lit())); |
There was a problem hiding this comment.
Missing-field filters lose rows
For a multi-row file, rewriting s.y.is_null() to null_lit().is_null() produces a one-element boolean array. eval_predicate_mask passes it unchanged to array filtering and bool_array_to_row_selection, so the selection covers only the first row instead of keeping every row.
Expand constant masks to the batch length before using them, and add a multi-row read test. The new tests only check rewriting and binding.
Merging this PR will improve performance by 10.08%2 warnings
Performance Changes
Tip Curious why performance improved? Comment Comparing Footnotes
|
Fixes #7658
Cause
When a filter is pushed down to the parquet reader,
substitute_missing_colsreplaces columns absent from the file schema with null literals. It only handled top-level columns. A predicate such ass.y.is_null()where structsexists in the file but lacks fieldy(schema evolution) was left as-is and failed when bound/evaluated against the file schema.Fix
substitute_missing_colsnow also rewritesstruct.get(field)to a null literal when the struct exists but has no such field, or when the parent was already substituted with null (nested access). Fields that are present are untouched.Tests
Rust unit tests in
daft-parquethelpers::tests: missing field, nested access under a missing struct, and a present field left alone. The first two fail without the change and pass with it.Disclosure
This change was prepared with the help of an AI coding assistant (Claude Code).
🤖 Generated with Claude Code