1
0

[HUDI-2115] FileSlices in the filegroup is not descending by timestamp (#3206)

This commit is contained in:
Shawy Geng
2021-07-07 22:24:36 +08:00
committed by GitHub
parent 990820476a
commit 55ecbc662e
2 changed files with 51 additions and 5 deletions

View File

@@ -21,13 +21,11 @@ package org.apache.hudi.common.model;
import org.apache.hudi.common.table.timeline.HoodieInstant;
import org.apache.hudi.common.table.timeline.HoodieTimeline;
import org.apache.hudi.common.util.Option;
import org.apache.hudi.common.util.collection.Pair;
import java.io.Serializable;
import java.util.Comparator;
import java.util.List;
import java.util.TreeMap;
import java.util.stream.Collectors;
import java.util.stream.Stream;
/**
@@ -62,9 +60,7 @@ public class HoodieFileGroup implements Serializable {
public HoodieFileGroup(HoodieFileGroup fileGroup) {
this.timeline = fileGroup.timeline;
this.fileGroupId = fileGroup.fileGroupId;
this.fileSlices = new TreeMap<>(fileGroup.fileSlices.entrySet().stream()
.map(e -> Pair.of(e.getKey(), new FileSlice(e.getValue())))
.collect(Collectors.toMap(Pair::getKey, Pair::getValue)));
this.fileSlices = new TreeMap<>(fileGroup.fileSlices);
this.lastInstant = fileGroup.lastInstant;
}