kbendick commented on a change in pull request #2863:
URL: https://github.com/apache/iceberg/pull/2863#discussion_r704770231



##########
File path: flink/src/main/java/org/apache/iceberg/flink/sink/FlinkSink.java
##########
@@ -321,7 +339,27 @@ private String operatorName(String suffix) {
           equalityFieldIds.add(field.fieldId());
         }
       }
-      IcebergStreamWriter<RowData> streamWriter = createStreamWriter(table, 
flinkRowType, equalityFieldIds);
+
+      // Fallback to use upsert mode parsed from table properties if don't 
specify in job level.
+      boolean upsertMode = upsert || 
PropertyUtil.propertyAsBoolean(table.properties(),
+          UPSERT_MODE_ENABLE, UPSERT_MODE_ENABLE_DEFAULT);
+
+      // Validate the equality fields and partition fields if we enable the 
upsert mode.
+      if (upsertMode) {
+        Preconditions.checkState(!overwrite,
+            "OVERWRITE mode shouldn't be enable when configuring to use UPSERT 
data stream.");

Review comment:
       Can you add a test that verifies the builder doesn't allow `overwrite` 
and `upsert` / upsertMode?
   
   Maybe I missed it, but seems like an important thing to have a test for in 
case of future code refractors.




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



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to