Skip to content

feat: add core COW rewrite primitive#2752

Open
u70b3 wants to merge 1 commit into
apache:mainfrom
u70b3:feat/core-cow-rewrite-primitive
Open

feat: add core COW rewrite primitive#2752
u70b3 wants to merge 1 commit into
apache:mainfrom
u70b3:feat/core-cow-rewrite-primitive

Conversation

@u70b3

@u70b3 u70b3 commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add iceberg::cow_rewrite with candidate planning, batch rewriter trait, replacement writer, orchestration builder, result stats, public API snapshot, and docs.
  • Reuse existing scan pruning/delete application while clearing the rewrite scan predicate so candidate files are read fully.
  • Cover DELETE-style, UPDATE-style, no-op, full-file delete, no-match delete, writer edge cases, delete-file planning, and multi-file replacement path uniqueness.

Core Design

  • Split COW into planning, batch rewriting, and replacement file writing so SQL planning and metadata commit can stay outside the primitive.
  • Plan candidates through the existing scan path to keep manifest pruning and delete-file application consistent with normal reads, then clear only the row predicate for full-file rewrite input.
  • Return removed, added, and unchanged DataFile sets plus stats; callers can pass these to a future overwrite/row-delta action.
  • Write replacement files with unique COW prefixes and preserve the partition values of each source file; this primitive does not repartition rewritten rows.

Related Work Map

flowchart LR
    Read["#2367 / #2414 / #2532<br/>delete-read improvements"] --> Scan["existing scan/read path<br/>visible rows"]
    Scan --> ThisPR["#2752<br/>COW rewrite primitive<br/>plan + rewrite + write files"]
    ThisPR --> Files["removed DataFiles<br/>added DataFiles<br/>stats"]
    Files --> Overwrite["#2185<br/>OverwriteAction<br/>preferred COW commit path"]
    Files --> RowDelta["#2203 / #2678<br/>RowDelta / MoR path"]
    Validator["#2590<br/>SnapshotValidator"] -. future commit validation .-> Overwrite
    Validator -. future commit validation .-> RowDelta
Loading

Notes

Test Plan

  • cargo fmt --all -- --check
  • make check
  • cargo test -p iceberg cow_rewrite
  • cargo test -p iceberg scan
  • cargo test -p iceberg writer
  • cargo test -p iceberg --doc cow_rewrite
  • cargo public-api -p iceberg --all-features -ss | diff - crates/iceberg/public-api.txt

@u70b3 u70b3 changed the title feat: add core COW rewrite primitive [wip] feat: add core COW rewrite primitive Jul 1, 2026
@u70b3 u70b3 force-pushed the feat/core-cow-rewrite-primitive branch from e6803c1 to d177d34 Compare July 1, 2026 01:42
@u70b3 u70b3 changed the title [wip] feat: add core COW rewrite primitive feat: add core COW rewrite primitive Jul 1, 2026
@u70b3 u70b3 force-pushed the feat/core-cow-rewrite-primitive branch 2 times, most recently from 88eb905 to 4f03d35 Compare July 6, 2026 10:39
Add a core copy-on-write rewrite primitive that plans candidate data files, applies a caller-provided RecordBatch rewriter, writes replacement data files, and returns removed/added/unchanged file sets for future overwrite-style commit actions.

Cover delete-style, update-style, no-op, full-file delete, no-match delete, delete-file planning, writer edge cases, and multi-source replacement path uniqueness.

Part of apache#2269.
@u70b3 u70b3 force-pushed the feat/core-cow-rewrite-primitive branch from 4f03d35 to 61b089c Compare July 9, 2026 06:52
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.

1 participant