Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,13 @@ public final class ChangelogMode {
private static final ChangelogMode INSERT_ONLY =
ChangelogMode.newBuilder().addContainedKind(RowKind.INSERT).build();

private static final ChangelogMode UPSERT =
ChangelogMode.newBuilder()
.addContainedKind(RowKind.INSERT)
.addContainedKind(RowKind.UPDATE_AFTER)
.addContainedKind(RowKind.DELETE)
.build();

private final Set<RowKind> kinds;

private ChangelogMode(Set<RowKind> kinds) {
Expand All @@ -51,6 +58,14 @@ public static ChangelogMode insertOnly() {
return INSERT_ONLY;
}

/**
* Shortcut for an upsert changelog that describes idempotent updates on a key and thus does not
* contain {@link RowKind#UPDATE_BEFORE} rows.
*/
public static ChangelogMode upsert() {
Copy link
Member

Choose a reason for hiding this comment

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

Could you use this method in valus source and sink? This can verify it works for the planner.

return UPSERT;
}

/** Builder for configuring and creating instances of {@link ChangelogMode}. */
public static Builder newBuilder() {
return new Builder();
Expand Down