[SS-78] Iceberg Sink Append Mode#35781
Open
ublubu wants to merge 9 commits intoMaterializeInc:mainfrom
Open
Conversation
|
Thanks for opening this PR! Here are a few tips to help make the review process smooth for everyone. PR title guidelines
Pre-merge checklist
|
DAlperin
approved these changes
Mar 31, 2026
Member
DAlperin
left a comment
There was a problem hiding this comment.
This is great. Approved mod some nits and SQL+TEST team approval
| let (arrow_schema_with_ids, iceberg_schema) = | ||
| relation_desc_to_iceberg_schema(&sink.from_desc)?; | ||
|
|
||
| Ok(if sink.envelope == SinkEnvelope::Append { |
Comment on lines
+380
to
+382
| let n = ctx.arrow_schema.fields().len().saturating_sub(2); | ||
| let user_schema_for_append = | ||
| Arc::new(ArrowSchema::new(ctx.arrow_schema.fields()[..n].to_vec())); |
Member
There was a problem hiding this comment.
maybe some kind of assert!(n >= 2 && fields[n-2].name() == "_mz_diff" && fields[n-1].name() == "_mz_timestamp",
"expected _mz_diff and _mz_timestamp as last two fields")
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
We want a copy of the update stream, so dump it into an Iceberg sink.
Description
This PR adds
MODE APPENDto Iceberg sinks.The "append" sink outputs data rows with additional
_mz_diffand_mz_timestampcolumns.Inserted row gets +1 diff. Removed row gets -1 diff.
Updated row becomes two output rows, with -1 (before) and +1 (after) diffs, respectively.
Pending Work
User-facing error (will be added to
pure.rsorddl.rs?) when the "FROM" table already contains columns named_mz_diffor_mz_timestamp.