Skip to content

fix(reader): prune data columns for empty projections - #3473

Open
comphead wants to merge 1 commit into
apache:mainfrom
comphead:fix-3472-empty-projection
Open

comphead wants to merge 1 commit into
apache:mainfrom
comphead:fix-3472-empty-projection

Conversation

@comphead

Copy link
Copy Markdown
Collaborator

Which issue does this PR close?

What changes are included in this PR?

An empty projection (project_field_ids == [], e.g. COUNT(*) or Spark's df.isEmpty) was excluded from the metadata-only path in FileScanTaskReader, so every column of every data file was read. Removing the !field_ids.is_empty() guard makes it take the existing metadata-only path: the RowNumber virtual column supplies the row count and ProjectionMask::none reads no data columns. The stale comments that described the old behavior are updated.

Are these changes tested?

Yes. test_empty_projection_reads_no_data_columns asserts 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 existing test_empty_projection_preserves_row_count still covers the row count. The full iceberg lib 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.

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.
@comphead
comphead marked this pull request as ready for review October 16, 2026 00:37
Copilot AI balanced review requested due to automatic review settings October 16, 2026 00:37

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 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

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Empty projection reads every column of every data file

2 participants