Skip to content

[core] Prune merged Data Evolution reads with Parquet statistics - #1469

Open
SteNicholas wants to merge 1 commit into
apache:mainfrom
SteNicholas:PAIMON-1445
Open

SteNicholas wants to merge 1 commit into
apache:mainfrom
SteNicholas:PAIMON-1445

Conversation

@SteNicholas

@SteNicholas SteNicholas commented Nov 20, 2026 •

Copy link
Copy Markdown
Member

Purpose

Closes #1445.

Selective filters can leave a Data Evolution merge decoding entire column files. Use Parquet statistics from the current column providers to build a shared row-ID selection and keep values aligned across files with different page boundaries.

Brief change log

  • Resolve current providers by stable field ID, historical schema, and file version. Use row-group and page statistics for each conjunct whose fields come from the same provider.
  • Intersect candidates with caller ranges and file-index hits, exclude deleted rows, and read the same positions from each provider. Apply the full predicate to the reconstructed rows before LIMIT.
  • Reuse Parquet metadata, validate page spans and projected page row counts, and retry failed indexed reads from whole column chunks. Ignore statistics with inconsistent NULL counts.
  • Keep the offset-only path for predicate-free sparse reads. When a selected span fits in one row group, check footer statistics first and skip the ColumnIndex if the footer proves that every row matches or none can match. If an optional ColumnIndex fails to decode, retry the OffsetIndex using the metadata bytes already fetched.

Tests

  • Rust 1.98.0 passed 5,112 core unit tests and 59 targeted integration tests. Eight core tests are ignored by default. cargo fmt --all -- --check and git diff --check passed.
  • With a 100,000-row, 49-column predicate file and 64 rows per page, sparse matching reads return the same rows and read the same column-data and total bytes with pushdown enabled or disabled. The regression also covers a narrow fixture with one-row pages and verifies that a footer-rejected selection decodes no rows. Sparse-read I/O regression
  • Regressions cover projected page alignment, damaged indexes and file errors, and inconsistent NULL counts.

Benchmark

Both settings returned identical results. The table reports medians from seven runs with alternating execution order and the shared metadata cache disabled.

Filter Rows sent to merge, off → on Column-data bytes, off → on Total bytes, off → on Median time, off → on
Selective (1 result) 524,288 → 128 2,342,012 → 3,595 3,390,588 → 1,157,808 49.65 → 15.71 ms
Full range (262,144 results) 524,288 → 524,288 2,342,012 → 2,342,012 3,390,588 → 3,390,588 57.92 → 62.08 ms

API and Format

The Java-compatible data-evolution.merged-read.stats-pushdown.enabled option defaults to true. It applies to row-tracked, unbucketed Data Evolution append tables whose ordinary Parquet files share a complete row-ID range. Both settings read the existing storage format.

Documentation

🤖 Assisted with Codex.

@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.

Shared row ranges have end-to-end value. The earlier undersized-page case now falls back. Locally, 46 integration tests, eight candidate-range cases and 102 Parquet tests passed. The selective benchmark returned the same row and reduced column data reads from 2,342,012 bytes to 756. Two additional probes exposed the cases below.

@SteNicholas
SteNicholas force-pushed the PAIMON-1445 branch 2 times, most recently from b6d1080 to 789b8d6 Compare November 22, 2026 05:52
@SteNicholas SteNicholas changed the title [core] Prune merged Data Evolution reads with shared row-ID ranges [core] Prune merged Data Evolution reads with Parquet statistics Nov 22, 2026
@SteNicholas

Copy link
Copy Markdown
Member Author

@JingsongLi, I reran the four regression tests for the cases you reported after rebasing 05bb9b71 onto main. All four passed on the current head. Commit 51374832

  • With id >= 0 and only _ROW_ID = 102117 requested, statistics rule out no rows, so the reader keeps the cached OffsetIndex. Pushdown on and off both return (id=2117, _ROW_ID=102117) and read the same number of column-data bytes, less than a full chunk. Sparse-read regression
  • When statistics do produce candidates, projected page boundaries still need independent row counts, even if the caller already selected exactly those rows. Without those counts the reader decodes whole chunks. Your rating = 36 case returns (id=36, _ROW_ID=100036). Projected-row regression
  • Predicate-free sparse reads request only the OffsetIndex. When both indexes are optional and the ColumnIndex fails to decode, the reader retries the offsets using metadata bytes it already fetched. Index-loading regression
  • Indexed data pages must be contiguous and the final page must end at the chunk boundary. With the last page recorded one byte short, the reader falls back to the full chunk and rating = 4095 still returns the last row. Page-span regression

@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.

Shared Parquet statistics can reduce the work needed for selective Data Evolution reads. The merged-reader and Parquet suites passed locally on aaa35f6f, and the earlier offset-only fallback preserved data-page reads in the new probe. I reproduced a separate cold-read I/O regression below.

Selective filters can leave a Data Evolution merge decoding entire
column files. Column updates can leave stale values in older files,
and Parquet pages can start at different rows across providers. A
shared row-ID selection keeps the current values aligned during the
merge.

- Prune row groups and pages with statistics from the current provider
  of every field in a conjunct, addressing apache#1445.
- Intersect candidates with caller ranges and bitmap hits, exclude
  deleted rows, and apply the full filter to reconstructed rows
  before LIMIT.
- Reuse Parquet metadata and validate projected page row counts. Skip
  column indexes when footer statistics settle a sparse selection,
  and retry failed indexed reads from whole column chunks.
- Enable pruning by default for row-tracked, unbucketed Data Evolution
  tables using Java's data-evolution.merged-read.stats-pushdown.enabled
  option. Benchmark selective and full-range reads.
@SteNicholas

Copy link
Copy Markdown
Member Author

Thanks for checking the earlier fallback and reproducing the cold-read regression. The force-pushed commit keeps sparse reads on the OffsetIndex path when row-group footer statistics can decide the predicate. The regression checks that pushdown on and off return the same rows and read the same column-data and total bytes on both the wide and narrow fixtures. Review · Commit 03980db2 · Regression

The same commit updates Parquet to 59.3.3 and refreshes the dependency reports. The dependency policy, dependency report verification, and release license checks pass locally. RustSec advisory

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.

[Improvement] Prune Data Evolution merged reads using shared candidate row ranges

2 participants