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 Data Evolution reads decoding entire column files. This change uses Parquet statistics from the current column providers to build one shared row-ID selection, keeping reconstructed values aligned across files with different page boundaries.

Brief change log

  • Resolve the current providers by field ID, historical schema, and file version. Prune row groups and pages for conjuncts covered by one provider when the file, table, and effective read types preserve comparisons.
  • Intersect candidates with requested ranges and bitmap hits, exclude deleted rows, and read the same positions from each provider. Apply the full predicate to reconstructed rows before LIMIT.
  • Reuse Parquet metadata between planning and decoding. Validate indexed byte spans, page row counts, and null statistics. Fall back to whole column chunks when projected page boundaries cannot be verified or indexed decoding fails.
  • Check the footer first for selections inside one row group. Compatible statistics can reject a selection without a separate page-index request. Keep predicate-free reads, inconclusive point reads, and sparse ranges with expensive column indexes on the offset-only path when appropriate. If an optional ColumnIndex fails to decode, reuse fetched bytes to recover the OffsetIndex.

Tests

  • Rust 1.98.0 passed 5,179 core unit tests and 63 targeted integration tests. Nine core tests are ignored by default. Formatting and diff checks passed.
  • The explicit read-type regression verifies that INT to TINYINT projections preserve matches on full and sparse reads, while widening to BIGINT still prunes.
  • The sparse-read I/O regression uses a 100,000-row, 49-column provider with 64 rows per page. Same-page and cross-page two-row selections return identical results and read identical column-data and total bytes with pushdown on or off. The test also checks that a footer-rejected selection reads zero data bytes and issues no separate index request.
  • Additional regressions cover projected page alignment, damaged indexes and file errors, and inconsistent null counts.

Benchmark

The in-memory benchmark returned identical results in both modes. Median times come from seven alternating runs in the Rust 1.98.0 test profile with 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 62.82 → 21.27 ms
Full range (262,144 results) 524,288 → 524,288 2,342,012 → 2,342,012 3,390,588 → 3,390,588 73.65 → 78.80 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.

@SteNicholas
SteNicholas force-pushed the PAIMON-1445 branch 2 times, most recently from edc2753 to 03980db Compare November 23, 2026 19:28
@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

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

The shared selection has end-to-end value for selective merged reads. The full core suite passed 5,112 tests locally. The earlier footer-decidable sparse reads, page alignment and optional-index fallback cases pass on this head. An additional counting-I/O test reproduced the point-read regression below.

@SteNicholas

Copy link
Copy Markdown
Member Author

Thanks for rerunning the core suite and reproducing the point-read regression, @JingsongLi. The follow-up keeps a single selected row on the OffsetIndex path when the row-group footer is inconclusive and lets the merged residual evaluate that row. A footer that rules out the row still skips decoding.

On the 100,000-row fixture with a 49-column rating provider, _ROW_ID = 102117 returns the expected row for rating >= 2117 and no rows for rating >= 2118. Both cases read the same data-page and total bytes with pushdown on and off. The core suite passed 5,113 tests, with 8 ignored. Review · Commit 942195a3 · Regression test

@SteNicholas

Copy link
Copy Markdown
Member Author

Ping @JingsongLi.

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

The shared selection has end-to-end value. On 1646549b integrated with ebcff9f1, 39 table integration tests and 14 candidate-selection tests passed. The local cold-metadata selective benchmark returned the same result and reduced total reads from 3,390,588 to 1,157,808 bytes. Two additional read cases reproduced the issues below.

Selective filters can leave Data Evolution reads decoding entire
column files. Issue apache#1445 calls for shared candidate row ranges to
reduce Parquet reads while keeping current column values aligned.

- Resolve current providers by field ID, schema and file version.
  Prune row groups and pages when a provider owns the whole conjunct
  and the effective read type preserves comparisons.
- Intersect candidate row IDs with requested ranges, bitmap hits and
  live rows. Apply residual filters to reconstructed rows before LIMIT.
- Reuse Parquet footers and indexes between planning and decoding.
  Avoid unnecessary index I/O for sparse selections.
- Validate indexed byte spans, page row counts and null statistics.
  Fall back to whole column chunks when projected page row counts
  cannot be verified or indexed decoding fails.
- Enable pruning by default for row-tracked, unbucketed tables under
  Java's merged-read statistics pushdown option.
- Test schema evolution, sparse read I/O and damaged metadata.
  Document the option and benchmark selective and full-range reads.
@SteNicholas

Copy link
Copy Markdown
Member Author

Thanks for the review and both reproductions, @JingsongLi. I pushed 23c1c85d with both fixes.

  • Pruning now checks the effective read type. The explicit TINYINT projection retains row 2117 for rating = 69, and widening to BIGINT still prunes. Read-type fix and regression
  • The same-page two-row selection stays on the offset-only path. The regression also covers two rows across a page boundary and verifies that pushdown on and off read the same column-data and total bytes. Sparse-read fix and regression

The updated head passed 5,179 core unit tests and 63 targeted integration tests. I reran the selective benchmark and confirmed the same result, with total reads falling from 3,390,588 to 1,157,808 bytes.

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