SteNicholas commented on code in PR #1784:
URL: https://github.com/apache/incubator-paimon/pull/1784#discussion_r1289735061


##########
paimon-core/src/main/java/org/apache/paimon/schema/SchemaValidation.java:
##########
@@ -92,6 +92,15 @@ public static void validateTableSchema(TableSchema schema) {
                             WRITE_MODE.key(), APPEND_ONLY, 
CHANGELOG_PRODUCER.key()));
         }
 
+        if (options.writeMode() == WriteMode.AUTO
+                && CollectionUtil.isNullOrEmpty(schema.primaryKeys())
+                && changelogProducer != ChangelogProducer.NONE) {
+            throw new UnsupportedOperationException(
+                    String.format(
+                            "Can not set %s on table without primary keys.",

Review Comment:
   We could improve the exception message to help users to solve, like `when 
set write mode to none, the table must have primary key` etc. Meanwhile, adds 
this information into document to reduce the situation that the users have this 
validation failure.



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