rdsr commented on a change in pull request #782: Incremental scan followups
URL: https://github.com/apache/incubator-iceberg/pull/782#discussion_r377408828
 
 

 ##########
 File path: core/src/main/java/org/apache/iceberg/IncrementalDataTableScan.java
 ##########
 @@ -137,4 +136,29 @@ protected TableScan newRefinedScan(
     }
     return snapshots;
   }
+
+  private void validateSnapshotIdsRefinement(long newFromSnapshotId, long 
newToSnapshotId) {
+    Set<Long> snapshotIdsRange = Sets.newHashSet(
+        SnapshotUtil.snapshotIdsBetween(table(), fromSnapshotId, 
toSnapshotId));
+    // since snapshotIdsBetween return ids in range (fromSnapshotId, 
toSnapshotId]
+    snapshotIdsRange.add(fromSnapshotId);
+    Preconditions.checkArgument(
+        snapshotIdsRange.contains(newFromSnapshotId),
+        "newFromSnapshotId %s not in existing snapshot ids range (%s, %s]",
+        newFromSnapshotId, fromSnapshotId, newToSnapshotId);
+    Preconditions.checkArgument(
+        snapshotIdsRange.contains(newToSnapshotId),
+        "newToSnapshotId %s not in existing snapshot ids range (%s, %s]",
+        newToSnapshotId, fromSnapshotId, toSnapshotId);
+  }
+
+  private static void validateSnapshotIds(Table table, long fromSnapshotId, 
long toSnapshotId) {
+    Preconditions.checkArgument(fromSnapshotId != toSnapshotId, 
"fromSnapshotId and toSnapshotId cannot be the same");
 
 Review comment:
   Makes sense. Fixed

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

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

Reply via email to