Zouxxyy opened a new pull request, #8236:
URL: https://github.com/apache/paimon/pull/8236

   ### Purpose
   
   A Paimon snapshot only records the physical `CommitKind` 
(APPEND/COMPACT/OVERWRITE/...), not the logical operation that produced it — so 
an APPEND from `INSERT INTO` cannot be told apart from one produced by `MERGE 
INTO`.
   
   This PR records the logical operation type in the snapshot `properties` map 
under the key `operation`. No format change — `Snapshot` already has a 
`properties: Map<String, String>` field.
   
   Core: add `InnerTableCommit#withCommitProperties(...)`, applied in 
`TableCommitImpl` so the properties land on every snapshot the commit generates 
(both the append and overwrite paths, since `FileStoreCommitImpl` sources 
snapshot properties from `committable.properties()`).
   
   Spark (both v1 and v2 write paths):
   
   | SQL | operation |
   | --- | --- |
   | INSERT INTO | `WRITE` |
   | INSERT OVERWRITE | `OVERWRITE` |
   | DELETE | `DELETE` |
   | UPDATE | `UPDATE` |
   | MERGE INTO | `MERGE` |
   | CREATE TABLE AS SELECT | `CREATE TABLE AS SELECT` |
   | (CREATE OR) REPLACE TABLE AS SELECT | `REPLACE TABLE AS SELECT` / `CREATE 
OR REPLACE TABLE AS SELECT` |
   
   ### Tests
   
   Added `SnapshotOperationTest` (paimon-spark-ut) asserting the recorded 
`operation` for INSERT/OVERWRITE/UPDATE/DELETE/MERGE under both 
`spark.paimon.write.use-v2-write=true` and `false`, plus CTAS/RTAS.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to