junmuz commented on code in PR #10702:
URL: https://github.com/apache/paimon/pull/10702#discussion_r4348366730


##########
paimon-core/src/main/java/org/apache/paimon/mergetree/compact/LookupChangelogMergeFunctionWrapper.java:
##########
@@ -152,18 +183,27 @@ private void setChangelog(@Nullable KeyValue before, 
KeyValue after) {
             }
         } else {
             if (!after.isAdd()) {
-                reusedResult.addChangelog(replaceBefore(RowKind.DELETE, 
before));
+                reusedResult.addChangelog(
+                        replaceBeforeWithSequenceOverwrite(RowKind.DELETE, 
before, after));
             } else if (valueEqualiser == null
                     || !valueEqualiser.equals(before.value(), after.value())) {
                 reusedResult
-                        .addChangelog(replaceBefore(RowKind.UPDATE_BEFORE, 
before))
+                        .addChangelog(
+                                replaceBeforeWithSequenceOverwrite(
+                                        RowKind.UPDATE_BEFORE, before, after))
                         .addChangelog(replaceAfter(RowKind.UPDATE_AFTER, 
after));
             }
         }
     }
 
-    private KeyValue replaceBefore(RowKind valueKind, KeyValue from) {
-        return replace(reusedBefore, valueKind, from);
+    private KeyValue replaceBeforeWithSequenceOverwrite(
+            RowKind valueKind, KeyValue before, KeyValue after) {
+        if (reusedOverwriteRow != null) {
+            reusedOverwriteRow.replace(before.value(), after.value());

Review Comment:
   I've restricted changelog-producer.preserve-field-on-retract to the 
deduplicate merge engine with the lookup changelog producer. Other merge 
engines, including partial-update, are rejected during schema validation. The 
check explicitly allows only deduplicate, so future merge engines are rejected 
by default too.
   
   Added tests for both CREATE and ALTER with partial-update, aggregation, and 
first-row. A rejected CREATE saves no schema, and a rejected ALTER leaves the 
existing schema and options unchanged. The documentation now states these 
restrictions and the CREATE/ALTER behavior explicitly.



-- 
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