Skip to content

Flink: Integrate ConvertEqualityDeletes with IcebergSink#17142

Open
mxm wants to merge 3 commits into
apache:mainfrom
mxm:resolve-equality-deletes.icebergsink
Open

Flink: Integrate ConvertEqualityDeletes with IcebergSink#17142
mxm wants to merge 3 commits into
apache:mainfrom
mxm:resolve-equality-deletes.icebergsink

Conversation

@mxm

@mxm mxm commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

This adds the option to run ConvertEqualityDeletes as a post-commit maintenance task on IcebergSink, similarly to the RewriteDataFiles / ExpireSnapshots / DeleteOrphanFiles post-commit integration. The sink's write branch becomes the converter's staging branch. The target branch defaults to the same branch (in-place conversion). This is also configurable via options on the builder, as well as via properties (see ConvertEqualityDeletesConfig). Equality field columns are derived from the resolved equality field ids of the sink, to ensure they match with the sink's equality fields.

Documentation changes are in separate commits. Ideally, they should be preserved to make backporting of the code changes more straight-forward.

mxm added 3 commits July 9, 2026 12:21
This adds the option to run `ConvertEqualityDeletes` as a post-commit
maintenance task on `IcebergSink`, similarly to the RewriteDataFiles /
ExpireSnapshots / DeleteOrphanFiles post-commit integration. The sink's write
branch becomes the converter's staging branch. The target branch defaults to the
same branch (in-place conversion). This is also configurable via options on the
builder, as well as via properties (see ConvertEqualityDeletesConfig). Equality
field columns are derived from the resolved equality field ids of the sink, to
ensure they match with the sink's equality fields.
| flink-maintenance.expire-snapshots.enabled | false | Expire snapshots after commit |
| flink-maintenance.delete-orphan-files.enabled | false | Delete orphan files after commit |
| flink-maintenance.convert-equality-deletes.enabled | false | Convert equality deletes to deletion vectors after commit (requires equality fields and format version >= 3) |
| flink-maintenance.convert-equality-deletes.target-branch | Write branch | Branch the converted DVs are committed to; defaults to the write branch (in-place conversion) |

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.

Do we want this here?
Maybe it is enough to keep the detailed config on the flink-maintenance.md

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

Added 2 nitty comments, the logic itself LGTM

| flink-maintenance.expire-snapshots.enabled | false | Expire snapshots after commit |
| flink-maintenance.delete-orphan-files.enabled | false | Delete orphan files after commit |
| flink-maintenance.convert-equality-deletes.enabled | false | Convert equality deletes to deletion vectors after commit (requires equality fields and format version >= 3) |
| flink-maintenance.convert-equality-deletes.target-branch | Write branch | Branch the converted DVs are committed to; defaults to the write branch (in-place conversion) |

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

nit: The config option itself has no default value. Maybe it would be less confusing to keep this table in sync with that and put null to the Default table col (based on the read option table) and rephrase the description that something like "if not specified, the write branch will be used (in-place conversion)"


JobClient jobClient = env.executeAsync("Test Convert Equality Deletes E2E");
try {
Awaitility.await()

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

nit: static import for await(), as it's a widely used lib and a common practice

flinkConf.put("flink-maintenance.delete-orphan-files.min-age-seconds", "259200");

// Configure convert equality deletes. Converts in place on the write branch by default;
// set a target branch to instead promote the converted deletion vectors there.

@ferenc-csaky ferenc-csaky Jul 9, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

nit: weird sentence, possible rewording:

// set a target branch to promote the converted deletion vectors there instead.

Comment thread docs/docs/flink-writes.md
- The `RANGE` distribution mode is not yet available for the `IcebergSink`
- When using `IcebergSink` use `uidSuffix` instead of the `uidPrefix`

### Post-commit table maintenance

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.

Should we only make this part only in flink-maintenance.md?

);
```

### IcebergSink Maintenance Configuration (SQL)

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.

Should we add related config in this part?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants