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


##########
paimon-core/src/main/java/org/apache/paimon/schema/SchemaValidation.java:
##########
@@ -205,6 +206,24 @@ public static void validateTableSchema(TableSchema schema, 
Set<String> dynamicOp
                             "Can not set %s on table without primary keys, 
please define primary keys.",
                             CHANGELOG_PRODUCER.key()));
         }
+        List<String> preserveFields = 
options.changelogPreserveFieldOnRetract();
+        if (!preserveFields.isEmpty()) {
+            checkArgument(
+                    options.mergeEngine() == MergeEngine.DEDUPLICATE,
+                    "'%s' is only supported with 'merge-engine' = 
'deduplicate'.",
+                    CHANGELOG_PRODUCER_PRESERVE_FIELD_ON_RETRACT.key());
+            checkArgument(
+                    changelogProducer == ChangelogProducer.LOOKUP,

Review Comment:
   [P2] Clear preserved fields from internal rescale copies that disable 
changelog
   
   A valid table with bucket=-2, postpone.batch-write-fixed-bucket=true, 
changelog-producer=lookup and preserve-field-on-retract=event_ts fails Spark 
batch-write coordinator initialization. SparkPostponeStagedCommitter eagerly 
builds rescaleWriteBuilder by copying the table with changelog-producer=none, 
retaining the new preserve option; AbstractFileStoreTable.copy runs this 
validation and throws before commit. The real table creation succeeds, and the 
actual coordinator constructor succeeds without the preserve option or with the 
exact baseline validation. Keep the CREATE/ALTER restriction, but clear the 
preserve option on internal copies that deliberately disable changelog 
production, and cover a Spark postpone fixed-bucket write with preservation 
enabled.



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