hililiwei commented on code in PR #6401: URL: https://github.com/apache/iceberg/pull/6401#discussion_r1066631675
########## flink/v1.14/flink/src/main/java/org/apache/iceberg/flink/source/enumerator/ContinuousSplitPlannerImpl.java: ########## @@ -213,17 +213,12 @@ static Optional<Snapshot> startSnapshot(Table table, ScanContext scanContext) { "Start snapshot id not found in history: " + scanContext.startSnapshotId()); return Optional.of(matchedSnapshotById); case INCREMENTAL_FROM_SNAPSHOT_TIMESTAMP: - long snapshotIdAsOfTime = - SnapshotUtil.snapshotIdAsOfTime(table, scanContext.startSnapshotTimestamp()); - Snapshot matchedSnapshotByTimestamp = table.snapshot(snapshotIdAsOfTime); - if (matchedSnapshotByTimestamp.timestampMillis() == scanContext.startSnapshotTimestamp()) { - return Optional.of(matchedSnapshotByTimestamp); - } else { - // if the snapshotIdAsOfTime has the timestamp value smaller than the - // scanContext.startSnapshotTimestamp(), - // return the child snapshot whose timestamp value is larger - return Optional.of(SnapshotUtil.snapshotAfter(table, snapshotIdAsOfTime)); - } + Snapshot matchedSnapshotByTimestamp = + SnapshotUtil.oldestAncestorAfter(table, scanContext.startSnapshotTimestamp()); + Preconditions.checkArgument( Review Comment: ``` appendTwoSnapshots(); long invalidSnapshotTimestampMs = snapshot2.timestampMillis() + 1000L; ``` It returns null when using a timestamp larger than the latest snapshot of the table or there are no snapshots. UT fail for this reason. -- 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