kbendick commented on code in PR #5050:
URL: https://github.com/apache/iceberg/pull/5050#discussion_r933426976


##########
flink/v1.15/flink/src/test/java/org/apache/iceberg/flink/TestFlinkUpsert.java:
##########
@@ -165,6 +165,52 @@ public void testUpsertAndQuery() {
     }
   }
 
+  @Test
+  public void testUpsertOptions() {
+    String tableName = "test_upsert_options";
+    LocalDate dt20220301 = LocalDate.of(2022, 3, 1);
+    LocalDate dt20220302 = LocalDate.of(2022, 3, 2);
+
+    tableUpsertProps.remove(TableProperties.UPSERT_ENABLED);
+    sql(
+        "CREATE TABLE %s(id INT NOT NULL, province STRING NOT NULL, dt DATE, 
PRIMARY KEY(id,province) NOT ENFORCED) "
+            + "PARTITIONED BY (province) WITH %s",
+        tableName, toWithClause(tableUpsertProps));
+
+    try {
+      sql(
+          "INSERT INTO %s /*+ OPTIONS('upsert-enabled'='true')*/  VALUES "
+              + "(1, 'a', DATE '2022-03-01'),"
+              + "(2, 'b', DATE '2022-03-01'),"
+              + "(1, 'b', DATE '2022-03-01')",
+          tableName);
+
+      sql(
+          "INSERT INTO %s /*+ OPTIONS('upsert-enabled'='true')*/  VALUES "
+              + "(4, 'a', DATE '2022-03-02'),"
+              + "(5, 'b', DATE '2022-03-02'),"
+              + "(1, 'b', DATE '2022-03-02')",
+          tableName);
+
+      List<Row> rowsOn20220301 =
+          Lists.newArrayList(Row.of(2, "b", dt20220301), Row.of(1, "a", 
dt20220301));
+      TestHelpers.assertRows(

Review Comment:
   We should consider refactoring these in a follow up PR so the table is 
partitioned by date.
   
   I've encountered this confusion as well before.



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