Skip to content

fix(core): read data-evolution files of an incremental window that are not column slices as stored - #1422

Open
jackylee-ch wants to merge 6 commits into
apache:mainfrom
jackylee-ch:fix/data-evolution-column-slices
Open

jackylee-ch wants to merge 6 commits into
apache:mainfrom
jackylee-ch:fix/data-evolution-column-slices

Conversation

@jackylee-ch

Copy link
Copy Markdown
Contributor

Purpose

Linked issue: N/A (bug fix)

Reading the window of incremental-between-timestamp of a data-evolution table fails when a compaction merged the files of two inserts and an update then covered the merged rows: "All data files in a field merge split should have the same row id range". The window holds the two inserts' files and the update's file, which are not column slices of one row range, and the reader tried to merge them into one group.

Brief change log

  • DataEvolutionReader reads the files of a streaming (incremental) group that is not a column slice of one row range as they are stored, as it does for raw-convertible groups.
  • New is_data_evolution_column_slice_group decides this: every normal file covers the same rows and every BLOB or vector file lies inside them. Real column slices (an insert and an update of its rows) still merge, and ordinary reads are unchanged.

Tests

  • Added data_evolution_window_test.rs: a window of an insert and a column update of its rows merges into the updated rows; a window of two inserts, a compaction and an update of every row reads the eight stored rows instead of failing. The second test fails on main and passes with this change.
  • Added a unit test for is_data_evolution_column_slice_group.
  • cargo test -p paimon passes; cargo fmt --check is clean.

API and Format

No API or storage format change.

Documentation

No documentation change.

…e not column slices as stored

A window of an incremental-between-timestamp read can hold the files of two inserts and the file of an update of the rows a compaction merged from them. These are not column slices of one row range, and merging them failed the read with 'All data files in a field merge split should have the same row id range'. Read the files of such a streaming group as they are stored. Groups of ordinary reads and real column slices are unchanged.

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

Requirement fit: SUPPORTED. Implementation: FINDINGS at 6e45635.

The incremental-window range mismatch is a real end-to-end problem, but the newly enabled raw-event path still returns incorrect results under ordinary projection and predicates. Reproduced with public write/compact/scan/read APIs in an isolated worktree; details inline. This is a completeness issue in the new supported path: the baseline full-width read throws the range-mismatch error.

Rust 1.98.0: relevant Data Evolution library tests and existing window, incremental, streaming, system-column and ROW-sidecar integration tests pass. Two independent review-only regression tests fail: full-width 8 events become 4 with an id-only projection, and value=1 incorrectly returns no events. In both tests, reusing the unfiltered full-width plan with the same projected/filtered reader returns the expected result, isolating the issue to planning before this reader branch. Head CI is green but does not cover these cases.

// split that are not column slices of one row range are
// independent changes and are read as they are stored.
if is_raw_convertible(&files)
|| (split.is_streaming() && !is_data_evolution_column_slice_group(&files))

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.

[P1] Apply physical-event semantics before scan pruning

Selecting raw events only here is too late: TableScan has already applied merged-row statistics and read-field pruning. On this PR's own two inserts (values 1..4) → compaction → value-only update to 50 fixture, the full timestamp window returns 8 physical events. With with_projection(&["id"]), its scan drops the update-only file and returns 4 rows; with with_filter(value = 1), latest-provider stats (min=max=50) drop the entire group and return zero instead of the original (1,1) event. Both are public-API reproductions on this exact head. Reading the original unfiltered/full-width plan through the same projected or filtered reader returns 8 or 1 respectively.

Please classify these physical-event groups before planner statistics/field pruning and use event-safe per-file pruning (preserving events whose projected fields are absent as NULL), or conservatively disable the merged-group optimizations for them. Add projection and predicate regressions alongside the two existing unfiltered window tests.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 373f19b: incremental non-column-slice groups now bypass merged statistics and projection pruning before the raw read, with projection and predicate regressions verified on the old and new heads.

@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 updated scan preserves projection and predicate handling for the original reproduction. All four existing window tests passed. A public write/compact/update/read probe found one additional case with a dedicated BLOB column.

// split that are not column slices of one row range are
// independent changes and are read as they are stored.
if is_raw_convertible(&files)
|| (split.is_streaming() && !is_data_evolution_column_slice_group(&files))

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.

[P1] Keep an insert's dedicated BLOB slice with its data rows

This branch treats every file in the overlap group as an independent event. An ordinary Data Evolution insert can write a Parquet file and a dedicated .blob file for the same rows. Reproduced with a table (id INT, value INT, payload BLOB): insert two batches of two rows, compact the Parquet files, update value for all four row IDs, and read the timestamp window covering those snapshots. The scan emits 12 rows. Four contain id with a NULL payload, four contain the payload with a NULL id, and four are the value-only updates. Each original insert row has been split in two.

Keep companion files from the same insert together when separating events with different ranges. If the available metadata cannot identify those companions reliably, reject the shape explicitly until it can be read without inventing rows.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The window keeps each insert’s BLOB files with its data rows and returns four complete inserts and four value-only updates in your example.

@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 mixed-range window fix has end-to-end value, and the previous split-insert probe now passes. Locally, 127 integration tests and 96 reader/shuffle unit tests passed. Two additional write–compact–update–read probes found the cases below.

.iter()
.filter(|file| is_data_evolution_normal_file(file))
.count();
if anchors != 1

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.

[P1] Accept dedicated-only updates as identifiable incremental events

I inserted two two-row batches with a dedicated BLOB, compacted their ordinary files, and updated only the BLOB for row IDs 0 through 3 via the public row-ID update API. The legal update committed one .blob covering all four rows. This condition rejects that event because it has zero normal anchors, although its APPEND sequence identifies it independently of the inserts.

The regression also affects a projection that reads no BLOBs. new_incremental_scan(Delta, 1, 4).plan_combined() with only id projected returned IDs [3, 4] on the base. On this revision it fails planning with Cannot identify dedicated-file companions. Please handle standalone dedicated updates separately from ambiguous insert companions and retain their event boundaries.

}
if is_raw_convertible(&files) {
if is_raw_convertible(&files)
|| (split.is_streaming() && files.len() == 1)

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.

[P1] Allow omitted required table fields in physical update events

In the same two-insert and compaction fixture, I declared id INT NOT NULL and updated value and payload together. The update committed one normal slice and one BLOB slice, both covering the four updated row IDs. The full incremental window fails with Cannot read non-nullable field 'id' without a provider.

This is a physical update event with two contributing files. Its omitted id is expected to be absent, just as it is on the existing single-file physical update path. Read grouped event slices with the same missing-column semantics as the raw event path while preserving required-field checks for reconstructed snapshots.

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