linyanghao commented on code in PR #7218:
URL: https://github.com/apache/iceberg/pull/7218#discussion_r1157013722


##########
flink/v1.16/flink/src/test/java/org/apache/iceberg/flink/actions/TestRewriteDataFilesAction.java:
##########
@@ -386,4 +395,73 @@ public void testRewriteAvoidRepeateCompress() throws 
IOException {
     expected.add(SimpleDataUtil.createRecord(2, "b"));
     SimpleDataUtil.assertTableRecords(icebergTableUnPartitioned, expected);
   }
+
+  @Test
+  public void testRewriteNoConflictWithEqualityDeletes() throws IOException {
+    // Add 2 data files
+    sql("INSERT INTO %s SELECT 1, 'hello'", TABLE_NAME_UNPARTITIONED);
+    sql("INSERT INTO %s SELECT 2, 'world'", TABLE_NAME_UNPARTITIONED);
+
+    // Load 2 stale tables to pass to rewrite actions
+    Table stale1 =
+        validationCatalog.loadTable(TableIdentifier.of(icebergNamespace, 
TABLE_NAME_UNPARTITIONED));
+    Table stale2 =
+        validationCatalog.loadTable(TableIdentifier.of(icebergNamespace, 
TABLE_NAME_UNPARTITIONED));
+
+    // Enabled upsert
+    icebergTableUnPartitioned.refresh();
+    upgradeToVersion2((BaseTable) icebergTableUnPartitioned);
+    icebergTableUnPartitioned
+        .updateSchema()
+        .allowIncompatibleChanges()
+        .requireColumn("id")
+        .setIdentifierFields("id")
+        .commit();
+    icebergTableUnPartitioned
+        .updateProperties()
+        .set(TableProperties.UPSERT_ENABLED, "true")
+        .commit();
+
+    // Add 1 data file and 1 equality-delete file
+    sql("INSERT INTO %s SELECT 1, 'hi'", TABLE_NAME_UNPARTITIONED);
+
+    icebergTableUnPartitioned.refresh();

Review Comment:
   We need to refresh here, otherwise the files planned below will not be 
up-to-date.



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