Skip to content

Commit

Permalink
fix earliestSnapshot not included when use INCREMENTAL_BETWEEN_TIMESTAMP
Browse files Browse the repository at this point in the history
  • Loading branch information
chun.ji committed Aug 7, 2024
1 parent f0b97e9 commit 1803299
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,16 @@ public Result scan(SnapshotReader reader) {
|| endTimestamp < earliestSnapshot.timeMillis()) {
return new NoSnapshot();
}
// in org.apache.paimon.utils.SnapshotManager.earlierOrEqualTimeMills
// 1. if earliestSnapshotId or latestSnapshotId is null startingSnapshotId will be null
// 2. if earliestSnapShot.timeMillis() > startTimestamp startingSnapshotId will be
// earliestSnapShotId
// if earliestSnapShot.timeMillis() > startTimestamp we should include the earliestSnapShot
// data
Long startSnapshotId =
(startingSnapshotId == null) ? earliestSnapshot.id() - 1 : startingSnapshotId;
(startingSnapshotId == null || earliestSnapshot.timeMillis() > startTimestamp)
? earliestSnapshot.id() - 1
: startingSnapshotId;
Snapshot endSnapshot = snapshotManager.earlierOrEqualTimeMills(endTimestamp);
Long endSnapshotId = (endSnapshot == null) ? latestSnapshot.id() : endSnapshot.id();
IncrementalStartingScanner incrementalStartingScanner =
Expand Down

0 comments on commit 1803299

Please sign in to comment.