Repository navigation
Conversation
An empty projection (e.g. `COUNT(*)`) was excluded from the metadata-only path, so every column of every data file was read. Treat it as metadata-only so the RowNumber virtual column supplies the row count with zero data columns read.
There was a problem hiding this comment.
🟢 Approval recommended
The focused change reuses established metadata-only handling, with new I/O regression coverage and existing row-count coverage.
0 open findings
What changed in this PR
Fixes #3472 by routing empty projections through the reader’s existing metadata-only path, avoiding data-column reads while preserving row counts.
Changes:
- Treats empty projections as metadata-only and updates related comments.
- Adds regression coverage for reduced bytes read.
| File | Description |
|---|---|
crates/iceberg/src/arrow/reader/pipeline.rs |
Enables empty-projection pruning and adds an I/O regression test. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
This branch has not been deployed
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?
What changes are included in this PR?
An empty projection (
project_field_ids == [], e.g.COUNT(*)or Spark'sdf.isEmpty) was excluded from the metadata-only path inFileScanTaskReader, so every column of every data file was read. Removing the!field_ids.is_empty()guard makes it take the existing metadata-only path: theRowNumbervirtual column supplies the row count andProjectionMask::nonereads no data columns. The stale comments that described the old behavior are updated.Are these changes tested?
Yes.
test_empty_projection_reads_no_data_columnsasserts that an empty projection reads fewer bytes than projecting the wide column. It fails without the fix (2838 vs 2787 bytes) and passes with it. The existingtest_empty_projection_preserves_row_countstill covers the row count. The fulliceberglib suite passes (1976 tests), and clippy and fmt are clean.AI Disclosure
Drafted with Claude Code (Anthropic). Opened as a draft pending the author's review.