hililiwei commented on code in PR #5984:
URL: https://github.com/apache/iceberg/pull/5984#discussion_r1009314978


##########
api/src/main/java/org/apache/iceberg/IncrementalScan.java:
##########
@@ -21,6 +21,23 @@
 /** API for configuring an incremental scan. */
 public interface IncrementalScan<ThisT, T extends ScanTask, G extends 
ScanTaskGroup<T>>
     extends Scan<ThisT, T, G> {
+
+  /**
+   * Instructs this scan to look for changes starting from a particular 
snapshot (inclusive).
+   *
+   * <p>If the start snapshot is not configured, it is defaulted to the oldest 
ancestor of the end
+   * snapshot (inclusive).
+   *
+   * @param fromSnapshotId the start snapshot ID (inclusive)
+   * @param referenceName the ref used
+   * @return this for method chaining
+   * @throws IllegalArgumentException if the start snapshot is not an ancestor 
of the end snapshot
+   */
+  default ThisT fromSnapshotInclusive(long fromSnapshotId, String 
referenceName) {

Review Comment:
   We assume that the `fromSnapshotInclusive(String fromSnapshotRef)` is just 
use the snapshot that the tag binding, or the latest snapshot of the branch.
   
   Currently have the following methods:
   ```
   ThisT fromSnapshotInclusive(String fromSnapshotRef) // Use the snapshot that 
tag bound with, or the latest of the branch.
   
   ThisT fromSnapshotExclusive(String fromSnapshotRef); // Similar to the above
   
   ThisT toSnapshot(String fromSnapshotRef); // The end snapshot, tag bound to, 
or the latest snapshot of the branch.
   
   ThisT useBranch(String branchName); // switches the branch to the specified 
one.
   ```
   We can have the following scenarios
   
   ```
   table.newIncrementalScan()
         .fromSnapshotInclusive(snapshoitId or ref)
         .useBranch(branch1)
         .planTasks()
   ```
   Specify the start snapshsot or ref and switch the branch to branch1.  
   Can be used in streaming tasks
   
   ```
   table.newIncrementalScan()
         .fromSnapshotInclusive(snapshoitId or ref)
         .toSnapshot(snapshoitId or ref)
         .planTasks()
   ```
   Specifies the start and end snapshot or ref. 
   Can be used in batch tasks.
   
   



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