[spark] Record the write operation type in snapshot properties#8236
Open
Zouxxyy wants to merge 1 commit into
Open
[spark] Record the write operation type in snapshot properties#8236Zouxxyy wants to merge 1 commit into
Zouxxyy wants to merge 1 commit into
Conversation
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.
Purpose
A Paimon snapshot only records the physical
CommitKind(APPEND/COMPACT/OVERWRITE/...), not the logical operation that produced it — so an APPEND fromINSERT INTOcannot be told apart from one produced byMERGE INTO.This PR records the logical operation type in the snapshot
propertiesmap under the keyoperation. No format change —Snapshotalready has aproperties: Map<String, String>field.Core: add
InnerTableCommit#withCommitProperties(...), applied inTableCommitImplso the properties land on every snapshot the commit generates (both the append and overwrite paths, sinceFileStoreCommitImplsources snapshot properties fromcommittable.properties()).Spark (both v1 and v2 write paths):
WRITEOVERWRITEDELETEUPDATEMERGECREATE TABLE AS SELECTREPLACE TABLE AS SELECT/CREATE OR REPLACE TABLE AS SELECTTests
Added
SnapshotOperationTest(paimon-spark-ut) asserting the recordedoperationfor INSERT/OVERWRITE/UPDATE/DELETE/MERGE under bothspark.paimon.write.use-v2-write=trueandfalse, plus CTAS/RTAS.