Reo-LEI commented on a change in pull request #2863:
URL: https://github.com/apache/iceberg/pull/2863#discussion_r676167969



##########
File path: flink/src/main/java/org/apache/iceberg/flink/IcebergTableSink.java
##########
@@ -63,6 +63,7 @@ public SinkRuntimeProvider getSinkRuntimeProvider(Context 
context) {
         .tableLoader(tableLoader)
         .tableSchema(tableSchema)
         .equalityFieldColumns(equalityColumns)
+        .upsert(equalityColumns.size() > 0)

Review comment:
       I think we could enable `upsert` mode on flink sql when the primary key 
has been set

##########
File path: 
flink/src/main/java/org/apache/iceberg/flink/sink/BaseDeltaTaskWriter.java
##########
@@ -69,6 +72,9 @@ public void write(RowData row) throws IOException {
 
     switch (row.getRowKind()) {
       case INSERT:
+        if (upsert) {
+          writer.delete(row);
+        }

Review comment:
       I think we could only delete row on INSERT. I don't think there will be 
only have `UPDATE_AFTER` row and lost `UPDATE_BEFORE` situation. @openinx 
please check this.




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