Skip to content

Commit

Permalink
use snapshot when SnapshotReaderImpl.toChangesPlan
Browse files Browse the repository at this point in the history
  • Loading branch information
jerry-024 committed Jan 6, 2025
1 parent 52034b6 commit a1a37cc
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -391,14 +391,14 @@ public Plan readChanges() {
groupByPartFiles(plan.files(FileKind.DELETE));
Map<BinaryRow, Map<Integer, List<DataFileMeta>>> dataFiles =
groupByPartFiles(plan.files(FileKind.ADD));

return toChangesPlan(true, plan, plan.snapshot().id() - 1, beforeFiles, dataFiles);
Snapshot beforeSnapshot = snapshotManager.snapshot(plan.snapshot().id() - 1);
return toChangesPlan(true, plan, beforeSnapshot, beforeFiles, dataFiles);
}

private Plan toChangesPlan(
boolean isStreaming,
FileStoreScan.Plan plan,
long beforeSnapshotId,
Snapshot beforeSnapshot,
Map<BinaryRow, Map<Integer, List<DataFileMeta>>> beforeFiles,
Map<BinaryRow, Map<Integer, List<DataFileMeta>>> dataFiles) {
Snapshot snapshot = plan.snapshot();
Expand All @@ -416,7 +416,7 @@ private Plan toChangesPlan(
Map<Pair<BinaryRow, Integer>, List<IndexFileMeta>> beforDeletionIndexFilesMap =
deletionVectors
? indexFileHandler.scan(
beforeSnapshotId, DELETION_VECTORS_INDEX, beforeFiles.keySet())
beforeSnapshot, DELETION_VECTORS_INDEX, beforeFiles.keySet())
: Collections.emptyMap();
Map<Pair<BinaryRow, Integer>, List<IndexFileMeta>> deletionIndexFilesMap =
deletionVectors
Expand Down Expand Up @@ -476,7 +476,7 @@ public Plan readIncrementalDiff(Snapshot before) {
groupByPartFiles(plan.files(FileKind.ADD));
Map<BinaryRow, Map<Integer, List<DataFileMeta>>> beforeFiles =
groupByPartFiles(scan.withSnapshot(before).plan().files(FileKind.ADD));
return toChangesPlan(false, plan, before.id(), beforeFiles, dataFiles);
return toChangesPlan(false, plan, before, beforeFiles, dataFiles);
}

private RecordComparator partitionComparator() {
Expand Down

0 comments on commit a1a37cc

Please sign in to comment.