feat: prune unread Parquet leaves when a nested column is cast to a narrower type - #24090
Open
mbutrovich wants to merge 5 commits into
Open
feat: prune unread Parquet leaves when a nested column is cast to a narrower type#24090mbutrovich wants to merge 5 commits into
mbutrovich wants to merge 5 commits into
Conversation
adriangb
reviewed
Aug 4, 2026
Comment on lines
+19
to
+23
| # Nested projection pruning: a table whose declared nested type is narrower | ||
| # than the Parquet file's physical type reads only the declared leaves. | ||
| # The bytes-scanned assertions live in the Rust tests | ||
| # (datafusion/core/tests/parquet/expr_adapter.rs); this file covers the | ||
| # end-to-end SQL correctness path. |
Contributor
There was a problem hiding this comment.
Can we somehow assert that the pruning worked / the pad columns where not read?
Contributor
Author
There was a problem hiding this comment.
Added a full_schema table (no cast) and pinned bytes_scanned as a literal: 172 narrow vs 312 full. Rest stays masked, like limit_pruning.slt:103.
mbutrovich
marked this pull request as ready for review
August 4, 2026 17:26
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #24090 +/- ##
==========================================
+ Coverage 80.89% 80.91% +0.02%
==========================================
Files 1102 1103 +1
Lines 376111 376607 +496
Branches 376111 376607 +496
==========================================
+ Hits 304248 304725 +477
- Misses 53756 53773 +17
- Partials 18107 18109 +2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
33 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Which issue does this PR close?
Rationale for this change
When a table declares a nested column narrower than the Parquet file's physical type, DataFusion reads every leaf of the column and drops the extra subfields in memory instead of skipping them at read time.
This is a port of #23398 onto current main. #23398 (stacked on the merged #23396 and #23397, superseding an earlier attempt at #23392) implements the fix and was reviewed favorably, but has merge conflicts against main since a follow-up refactor moved PushdownChecker and PushdownColumns into projection_read_plan.rs, and has four unanswered review comments. This PR reimplements the same approach against current main and resolves those four comments by construction:
What changes are included in this PR?
Are these changes tested?
Are there any user-facing changes?
No API changes and no new configuration option. Behavior is IO reduction only, results are unchanged.