tomtongue commented on code in PR #9849:
URL: https://github.com/apache/iceberg/pull/9849#discussion_r1512208471


##########
core/src/test/java/org/apache/iceberg/TestIncrementalDataTableScan.java:
##########
@@ -196,56 +193,66 @@ public void testRollbacks() {
     transaction.commitTransaction();
     // Go back to snapshot "E"
     table.manageSnapshots().rollbackTo(5).commit();
-    Assert.assertEquals(5, table.currentSnapshot().snapshotId());
+    assertThat(table.currentSnapshot().snapshotId()).isEqualTo(5);
     filesMatch(Lists.newArrayList("B", "D", "E"), appendsBetweenScan(1, 5));
     filesMatch(Lists.newArrayList("B", "D", "E"), appendsAfterScan(1));
   }
 
-  @Test
+  @TestTemplate
   public void testIgnoreResiduals() throws IOException {
     add(table.newAppend(), files("A"));
     add(table.newAppend(), files("B"));
     add(table.newAppend(), files("C"));
 
-    TableScan scan1 = table.newScan().filter(Expressions.equal("id", 
5)).appendsBetween(1, 3);
+    IncrementalAppendScan scan1 =
+        table
+            .newIncrementalAppendScan()
+            .filter(Expressions.equal("id", 5))
+            .fromSnapshotExclusive(1)
+            .toSnapshot(3);
 
     try (CloseableIterable<CombinedScanTask> tasks = scan1.planTasks()) {
-      Assert.assertTrue(
-          "Tasks should not be empty", 
com.google.common.collect.Iterables.size(tasks) > 0);
+      assertThat(tasks).as("Tasks should not be empty").hasSizeGreaterThan(0);
       for (CombinedScanTask combinedScanTask : tasks) {
         for (FileScanTask fileScanTask : combinedScanTask.files()) {
-          Assert.assertNotEquals(
-              "Residuals must be preserved", Expressions.alwaysTrue(), 
fileScanTask.residual());
+          assertThat(fileScanTask.residual())
+              .as("Residuals must be preserved")
+              .isNotEqualTo(Expressions.alwaysTrue());
         }
       }
     }
 
-    TableScan scan2 =
-        table.newScan().filter(Expressions.equal("id", 5)).appendsBetween(1, 
3).ignoreResiduals();
+    IncrementalAppendScan scan2 =
+        table
+            .newIncrementalAppendScan()

Review Comment:
   As I commented above, `table.newScan().appendsBetween` is deprecated. Revert 
this part to the previous one.



##########
core/src/test/java/org/apache/iceberg/TestIncrementalDataTableScan.java:
##########
@@ -196,56 +193,66 @@ public void testRollbacks() {
     transaction.commitTransaction();
     // Go back to snapshot "E"
     table.manageSnapshots().rollbackTo(5).commit();
-    Assert.assertEquals(5, table.currentSnapshot().snapshotId());
+    assertThat(table.currentSnapshot().snapshotId()).isEqualTo(5);
     filesMatch(Lists.newArrayList("B", "D", "E"), appendsBetweenScan(1, 5));
     filesMatch(Lists.newArrayList("B", "D", "E"), appendsAfterScan(1));
   }
 
-  @Test
+  @TestTemplate
   public void testIgnoreResiduals() throws IOException {
     add(table.newAppend(), files("A"));
     add(table.newAppend(), files("B"));
     add(table.newAppend(), files("C"));
 
-    TableScan scan1 = table.newScan().filter(Expressions.equal("id", 
5)).appendsBetween(1, 3);
+    IncrementalAppendScan scan1 =
+        table
+            .newIncrementalAppendScan()
+            .filter(Expressions.equal("id", 5))
+            .fromSnapshotExclusive(1)
+            .toSnapshot(3);
 
     try (CloseableIterable<CombinedScanTask> tasks = scan1.planTasks()) {
-      Assert.assertTrue(
-          "Tasks should not be empty", 
com.google.common.collect.Iterables.size(tasks) > 0);
+      assertThat(tasks).as("Tasks should not be empty").hasSizeGreaterThan(0);
       for (CombinedScanTask combinedScanTask : tasks) {
         for (FileScanTask fileScanTask : combinedScanTask.files()) {
-          Assert.assertNotEquals(
-              "Residuals must be preserved", Expressions.alwaysTrue(), 
fileScanTask.residual());
+          assertThat(fileScanTask.residual())
+              .as("Residuals must be preserved")
+              .isNotEqualTo(Expressions.alwaysTrue());
         }
       }
     }
 
-    TableScan scan2 =
-        table.newScan().filter(Expressions.equal("id", 5)).appendsBetween(1, 
3).ignoreResiduals();
+    IncrementalAppendScan scan2 =
+        table
+            .newIncrementalAppendScan()
+            .filter(Expressions.equal("id", 5))
+            .fromSnapshotExclusive(1)
+            .toSnapshot(3)
+            .ignoreResiduals();
 
     try (CloseableIterable<CombinedScanTask> tasks = scan2.planTasks()) {
-      Assert.assertTrue(
-          "Tasks should not be empty", 
com.google.common.collect.Iterables.size(tasks) > 0);
+      assertThat(tasks).as("Tasks should not be empty").hasSizeGreaterThan(0);
       for (CombinedScanTask combinedScanTask : tasks) {
         for (FileScanTask fileScanTask : combinedScanTask.files()) {
-          Assert.assertEquals(
-              "Residuals must be ignored", Expressions.alwaysTrue(), 
fileScanTask.residual());
+          assertThat(fileScanTask.residual())
+              .as("Residuals must be ignored")
+              .isEqualTo(Expressions.alwaysTrue());
         }
       }
     }
   }
 
-  @Test
-  public void testPlanWithExecutor() throws IOException {
+  @TestTemplate
+  public void testPlanWithExecutor() {
     add(table.newAppend(), files("A"));
     add(table.newAppend(), files("B"));
     add(table.newAppend(), files("C"));
 
     AtomicInteger planThreadsIndex = new AtomicInteger(0);
-    TableScan scan =
+    IncrementalAppendScan scan =
         table
-            .newScan()
-            .appendsAfter(1)
+            .newIncrementalAppendScan()
+            .fromSnapshotExclusive(1)

Review Comment:
   As I commented above, `table.newScan().appendsBetween` is deprecated. Revert 
this part to the previous one.



##########
core/src/test/java/org/apache/iceberg/TestIncrementalDataTableScan.java:
##########
@@ -196,56 +193,66 @@ public void testRollbacks() {
     transaction.commitTransaction();
     // Go back to snapshot "E"
     table.manageSnapshots().rollbackTo(5).commit();
-    Assert.assertEquals(5, table.currentSnapshot().snapshotId());
+    assertThat(table.currentSnapshot().snapshotId()).isEqualTo(5);
     filesMatch(Lists.newArrayList("B", "D", "E"), appendsBetweenScan(1, 5));
     filesMatch(Lists.newArrayList("B", "D", "E"), appendsAfterScan(1));
   }
 
-  @Test
+  @TestTemplate
   public void testIgnoreResiduals() throws IOException {
     add(table.newAppend(), files("A"));
     add(table.newAppend(), files("B"));
     add(table.newAppend(), files("C"));
 
-    TableScan scan1 = table.newScan().filter(Expressions.equal("id", 
5)).appendsBetween(1, 3);
+    IncrementalAppendScan scan1 =
+        table
+            .newIncrementalAppendScan()

Review Comment:
   `table.newScan().appendsBetween` is marked as "deprecated" in 
https://iceberg.apache.org/javadoc/latest/org/apache/iceberg/TableScan.html so 
that I changed here.
   > Deprecated.
   since 1.0.0, will be removed in 2.0.0; use 
[Table.newIncrementalAppendScan()](https://iceberg.apache.org/javadoc/latest/org/apache/iceberg/Table.html#newIncrementalAppendScan())
 instead.
   
   But maybe this should be another PR, or keep it this time. Let me revert it 
to the previous version.



-- 
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-unsubscr...@iceberg.apache.org

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


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

Reply via email to