Commit 681a2c0
committed
feat: add delta writer for row-level changes
This commit adds support for row-level changes (inserts, updates, and deletes)
to Iceberg tables through a new DeltaWriter implementation. This enables CDC
(Change Data Capture), upsert operations, and efficient row-level deletions.
Key Components:
1. RowDeltaAction Transaction
- New transaction type for applying row-level changes atomically
- Supports both data files and delete files in a single transaction
- Located in transaction/row_delta.rs
2. Position Delete Writer
- Writes position delete files for efficient row-level deletions
- Deletes rows by file path and row position
- Located in writer/base_writer/position_delete_writer.rs
3. Delta Writer (Combined Writer)
- Orchestrates data file, position delete, and equality delete writers
- Intelligently routes operations based on row tracking
- Memory-bounded row tracking with configurable limits
- Falls back to equality deletes for older/evicted rows
- Located in writer/combined_writer/delta_writer.rs
Input Format:
The DeltaWriter expects RecordBatch with an operations column:
- Value 1 = Insert/Update (write to data file)
- Value -1 = Delete (write to delete file)
Memory Management:
- Tracks recently written rows for efficient position deletes
- Configurable max_seen_rows limit (default: 100,000)
- FIFO eviction when limit is reached
- Can be disabled (set to 0) to use only equality deletes1 parent c720895 commit 681a2c0
File tree
23 files changed
+2089
-44
lines changed- crates
- catalog/rest/src
- iceberg
- src
- transaction
- writer
- base_writer
- combined_writer
- file_writer
- partitioning
- integration_tests/tests
- integrations/datafusion/src
- physical_plan
23 files changed
+2089
-44
lines changedSome generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
| 50 | + | |
50 | 51 | | |
51 | 52 | | |
52 | 53 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
716 | 716 | | |
717 | 717 | | |
718 | 718 | | |
| 719 | + | |
| 720 | + | |
| 721 | + | |
| 722 | + | |
| 723 | + | |
| 724 | + | |
| 725 | + | |
719 | 726 | | |
720 | 727 | | |
721 | 728 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
49 | 49 | | |
50 | 50 | | |
51 | 51 | | |
| 52 | + | |
52 | 53 | | |
53 | 54 | | |
54 | 55 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
90 | 90 | | |
91 | 91 | | |
92 | 92 | | |
| 93 | + | |
93 | 94 | | |
94 | 95 | | |
95 | | - | |
96 | | - | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
97 | 106 | | |
98 | 107 | | |
99 | 108 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
| 57 | + | |
57 | 58 | | |
58 | 59 | | |
59 | 60 | | |
| |||
71 | 72 | | |
72 | 73 | | |
73 | 74 | | |
| 75 | + | |
74 | 76 | | |
75 | 77 | | |
76 | 78 | | |
| |||
141 | 143 | | |
142 | 144 | | |
143 | 145 | | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
144 | 156 | | |
145 | 157 | | |
146 | 158 | | |
| |||
0 commit comments