Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -526,8 +526,19 @@ private Plan toIncrementalPlan(
totalBuckets = beforeEntries.get(0).totalBuckets();
}

// deduplicate
beforeEntries.removeIf(dataEntries::remove);
// deduplicate: remove entries common to both lists
// Use HashSet for O(n+m) instead of O(n*m) with List.remove()
Set<ManifestEntry> afterSet = new HashSet<>(dataEntries);
Set<ManifestEntry> commonEntries = new HashSet<>();
beforeEntries.removeIf(
entry -> {
if (afterSet.contains(entry)) {
commonEntries.add(entry);
return true;
}
return false;
});
dataEntries.removeAll(commonEntries);

List<DataFileMeta> before =
beforeEntries.stream()
Expand Down
Loading