RussellSpitzer commented on code in PR #7326:
URL: https://github.com/apache/iceberg/pull/7326#discussion_r1214637270


##########
spark/v3.3/spark/src/test/java/org/apache/iceberg/spark/TestChangelogIterator.java:
##########
@@ -296,17 +306,67 @@ public void testCarryRowsRemoveNoInsertRows() {
     List<Row> rowsWithDuplication =
         Lists.newArrayList(
             // next two rows are identical
-            new GenericRowWithSchema(new Object[] {1, "d", "data", DELETE}, 
null),
-            new GenericRowWithSchema(new Object[] {1, "d", "data", DELETE}, 
null));
+            new GenericRowWithSchema(new Object[] {1, "d", "data", DELETE, 0, 
0}, null),
+            new GenericRowWithSchema(new Object[] {1, "d", "data", DELETE, 0, 
0}, null));
 
+    List<Object[]> expectedRows =
+        Lists.newArrayList(
+            new Object[] {1, "d", "data", DELETE, 0, 0},
+            new Object[] {1, "d", "data", DELETE, 0, 0});
+
+    validateIterators(rowsWithDuplication, expectedRows);
+  }
+
+  private void validateIterators(List<Row> rowsWithDuplication, List<Object[]> 
expectedRows) {
     Iterator<Row> iterator =
-        ChangelogIterator.removeCarryovers(rowsWithDuplication.iterator(), 
SCHEMA);
+        ChangelogIterator.removeCarryovers(
+            rowsWithDuplication.iterator(), SCHEMA_WITH_METADATA_COLUMNS);
     List<Row> result = Lists.newArrayList(iterator);
 
-    assertEquals(
-        "Duplicate rows should not be removed",
+    assertEquals("Rows should match.", expectedRows, rowsToJava(result));
+
+    iterator =
+        ChangelogIterator.removeNetCarryovers(
+            rowsWithDuplication.iterator(), SCHEMA_WITH_METADATA_COLUMNS);
+    result = Lists.newArrayList(iterator);
+
+    assertEquals("Rows should match.", expectedRows, rowsToJava(result));
+  }
+
+  @Test
+  public void testRemoveNetCarryovers() {
+    List<Row> rowsWithDuplication =
         Lists.newArrayList(
-            new Object[] {1, "d", "data", DELETE}, new Object[] {1, "d", 
"data", DELETE}),
-        rowsToJava(result));
+            new GenericRowWithSchema(new Object[] {0, "d", "data", DELETE, 0, 
0}, null),

Review Comment:
   these tests are a bit difficult for me to understand, could we just write 
out  some quick diagrams of the change sets? Basically giving us a timeline for 
each primary key 



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