Skip to content

fix(scan): prune data-evolution files by projection - #442

Merged
JingsongLi merged 1 commit into
apache:mainfrom
QuakeWang:de-prune
Jul 3, 2026
Merged

fix(scan): prune data-evolution files by projection#442
JingsongLi merged 1 commit into
apache:mainfrom
QuakeWang:de-prune

Conversation

@QuakeWang

Copy link
Copy Markdown
Member

Purpose

DataFusion projections were only applied at read time. For data-evolution tables, scan planning still kept every physical file in a row-id group even when the projected read type did not need the columns written by some files.

This made projection pruning ineffective for data-evolution planning and could keep unnecessary sidecar/partial-column files in planned splits.

Brief change log

  • Propagate DataFusion projection columns into ReadBuilder::new_scan().
  • Validate scan projection names consistently with reads.
  • Prune data-evolution row-id groups by projected stable field ids, including renamed-column cases.
  • Keep a normal representative file when needed for row count / merge reader constraints.
  • Keep the normal anchor when deletion vectors are enabled.
  • Cache (schema_id, write_cols) field-id resolution during scan planning.

Tests

  • cargo test -p paimon --all-targets --features fulltext,vortex,mosaic table::table_scan::tests::test_data_evolution_pruning
  • cargo test -p paimon --all-targets --features fulltext,vortex,mosaic table::read_builder::tests::test_new_scan_validates_unknown_projection
  • cargo test -p paimon-datafusion --all-targets test_scan_applies_projection_to_data_evolution_planning

API and Format

Documentation

Propagate DataFusion projections into scan planning so data-evolution tables can drop physical files whose write columns are not needed by the read type.

Resolve projection matches by stable field id across schema evolution, keep row-count representatives for empty or sidecar-only matches, and retain the normal anchor needed by deletion-vector planning.

Signed-off-by: QuakeWang <wangfuzheng0814@foxmail.com>

@JingsongLi JingsongLi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

+1

@JingsongLi
JingsongLi merged commit 4dcf2fa into apache:main Jul 3, 2026
8 checks passed
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.

2 participants