Skip to content

[connectors] read only the DV delta on rewrites in delta follow mode#6583

Merged
swanandx merged 1 commit into
mainfrom
issue6579
Jul 9, 2026
Merged

[connectors] read only the DV delta on rewrites in delta follow mode#6583
swanandx merged 1 commit into
mainfrom
issue6579

Conversation

@swanandx

@swanandx swanandx commented Jul 2, 2026

Copy link
Copy Markdown
Member

A same-path Add+Remove in the transaction log is a deletion-vector rewrite: the Parquet bytes are unchanged and only the DV differs. Follow mode read the whole file on each side and let the circuit cancel the unchanged rows, so a K-row change ingested roughly 2N-K records.

Pair such actions by path and decode both deletion vectors, then read only the rows the DV newly masks (deleted) or un-masks (restored). A K-row change now costs K records.

The Python platform DV suite asserts total_input_records to catch the amplification

Fix #6579

Describe Manual Test Plan

tested locally to verify it works

Checklist

  • Unit tests added/updated
  • Integration tests added/updated
  • Documentation updated
  • Changelog updated

Breaking Changes?

should not be breaking change

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

LGTM — clean optimization with solid test coverage. Two minor nits inline.

Comment thread crates/adapters/src/integrated/delta_table/input.rs
Comment thread crates/adapters/src/integrated/delta_table/input.rs

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

I cannot really ascertain the correctness, since I don't know the exact spec of Delta encodings, but here are some comments.

Comment thread crates/adapters/src/integrated/delta_table/deletion_vector.rs Outdated
Comment thread crates/adapters/src/integrated/delta_table/deletion_vector.rs Outdated
Comment thread crates/adapters/src/integrated/delta_table/deletion_vector.rs Outdated
Comment thread crates/adapters/src/integrated/delta_table/deletion_vector.rs Outdated
Comment thread crates/adapters/src/integrated/delta_table/deletion_vector.rs Outdated
}
}

// Process deletes before inserts. Semantically, delete actions are

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.

I hope that's correct, whether it is or not depends on the definition of the delta tables data structures.

// guarantee that actions occur in any particular order in the transaction log
// entry.
//
// Each pass hands `process_follow_action` the row-index delta for its

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.

what would be very useful is a set of small golden delta files with all sorts of combinations where the output is known; we could use these golden files to test that this does the right thing. Is there a delta table test suite where we could steal these files from?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

can be a follow up, we test this already in python integration tests. but if required can get files from there

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.

you can ask claude to investigate whether there are such tests we could borrow

Comment thread crates/adapters/src/integrated/delta_table/input.rs Outdated
Comment thread crates/adapters/src/integrated/delta_table/input.rs Outdated
Comment thread crates/adapters/src/integrated/delta_table/input.rs Outdated
@swanandx
swanandx requested review from mihaibudiu, mythical-fred and ryzhyk and removed request for mythical-fred July 3, 2026 16:09
@mihaibudiu mihaibudiu changed the title [adapters] read only the DV delta on rewrites in delta follow mode [connectors] read only the DV delta on rewrites in delta follow mode Jul 3, 2026
@mihaibudiu

Copy link
Copy Markdown
Contributor

Please change "adapters" to "connectors", this is the agreed-upon name. Unfortunately renaming the crate is harder.

fn push_run(selectors: &mut Vec<RowSelector>, skip: bool, count: u64) {
/// Append a [`RowSelector`] for `count` rows to `selectors`, selecting or
/// skipping them per `select`, merging into the previous selector when it is
/// the same kind. A zero-length selector is a no-op. `select`/skip is parquet's

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.

why is select backquoted and skip is not?

// guarantee that actions occur in any particular order in the transaction log
// entry.
//
// Each pass hands `process_follow_action` the row-index delta for its

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.

you can ask claude to investigate whether there are such tests we could borrow

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

Follow-up LGTM. Prior comments look cleanly addressed. One tiny s/&/g mishap noted inline.

Comment thread crates/adapters/src/integrated/delta_table/deletion_vector.rs Outdated
@swanandx
swanandx force-pushed the issue6579 branch 2 times, most recently from 884f337 to a157d1b Compare July 6, 2026 19:43
@swanandx
swanandx requested a review from mythical-fred July 6, 2026 19:43

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

LGTM. The DV-delta pairing is clean (data-change filter on both sides, new − old / old − new split, InBitmap read of only the changed rows, unpaired actions fall through to the whole-file path), the push_selector refactor drops the special-case gap handling with a nice proptest that pins keep ⊕ skip = 0..total_rows, and the docstring rename regression I flagged last round is fixed (both helper docs now correctly say Rows in ...).

The column-mapping addition is a good orthogonal extension: physical_read_schema renames only the fields whose ColumnMappingPhysicalName metadata differs from the logical name (so a table without column mapping is a strict no-op), advance_schema reloads the source table at each metaData commit so follow reads use the schema active when the commit was written, and project_physical_to_logical renames back after the DataFrame is built. Both name and id modes are exercised by tests; the mid-history / follow-from-version cases pin the "each commit resolves against its own schema" contract nicely, and _REPLAY_EXPECTED_ROWS documents the deliberate divergence from the snapshot expectation.

Nit (not blocking): the final squashed commit subject is still [adapters] read only the DV delta .... mihai asked for [connectors] on 2026-07-03; the PR title was updated but the commit subject was not. Fix on the way in.

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

Thank you!

A same-path Add+Remove in the transaction log is a deletion-vector
rewrite: the Parquet bytes are unchanged and only the DV differs. Follow
mode read the whole file on each side and let the circuit cancel the
unchanged rows, so a K-row change ingested roughly 2N-K records.

Pair such actions by path and decode both deletion vectors, then read
only the rows the DV newly masks (deleted) or un-masks (restored). A
K-row change now costs K records.

The Python platform DV suite asserts total_input_records to catch the
amplification

Signed-off-by: Swanand Mulay <73115739+swanandx@users.noreply.github.com>
@swanandx
swanandx enabled auto-merge July 9, 2026 09:53
@swanandx
swanandx added this pull request to the merge queue Jul 9, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jul 9, 2026
@swanandx
swanandx added this pull request to the merge queue Jul 9, 2026
Merged via the queue into main with commit d832bd8 Jul 9, 2026
1 check passed
@swanandx
swanandx deleted the issue6579 branch July 9, 2026 16:50
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.

[connectors] Delta follow/snapshot_and_follow re-ingests the whole file on a deletion-vector delete

4 participants