You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by GitBox <gi...@apache.org> on 2022/01/12 07:07:15 UTC

[GitHub] [iceberg] Reo-LEI commented on a change in pull request #3827: Docs: Add `Streaming upsert write` in flink.md

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



##########
File path: site/docs/flink.md
##########
@@ -522,6 +522,20 @@ FlinkSink.forRowData(input)
 env.execute("Test Iceberg DataStream");
 ```
 
+## Streaming upsert write
+
+Iceberg supports upsert based on the primary key when writing streaming data into v2 table format.
+
+```sql
+CREATE TABLE `hive_catalog`.`default`.`sample` (
+  `id`  INT UNIQUE COMMENT 'unique id',
+  `data` STRING NOT NULL,
+ PRIMARY KEY(`id`) NOT ENFORCED
+) with ('format-version'='2', 'write.upsert.enabled'='true');
+```
+!!! Note

Review comment:
       In UPSERT mode, if the table is partitioned, the partition fields should be a part of equality fields. I think this is important and should be mentioned in the docs. 
   
   https://github.com/apache/iceberg/blob/e0ff71dfa8ffb54941fcc82ae127ab06f271331c/flink/v1.14/flink/src/main/java/org/apache/iceberg/flink/sink/FlinkSink.java#L378




-- 
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: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org