danny0405 commented on code in PR #9879:
URL: https://github.com/apache/hudi/pull/9879#discussion_r1365498709
##########
hudi-common/src/main/java/org/apache/hudi/common/table/timeline/HoodieDefaultTimeline.java:
##########
@@ -480,20 +486,7 @@ public boolean isBeforeTimelineStarts(String instant) {
}
public Option<HoodieInstant> getFirstNonSavepointCommit() {
- Option<HoodieInstant> firstCommit = firstInstant();
- Set<String> savepointTimestamps = getInstantsAsStream()
- .filter(entry ->
entry.getAction().equals(HoodieTimeline.SAVEPOINT_ACTION))
- .map(HoodieInstant::getTimestamp)
- .collect(Collectors.toSet());
- Option<HoodieInstant> firstNonSavepointCommit = firstCommit;
- if (!savepointTimestamps.isEmpty()) {
- // There are chances that there could be holes in the timeline due to
archival and savepoint interplay.
- // So, the first non-savepoint commit is considered as beginning of the
active timeline.
- firstNonSavepointCommit = Option.fromJavaOptional(getInstantsAsStream()
- .filter(entry -> !savepointTimestamps.contains(entry.getTimestamp()))
Review Comment:
This codes interate over the instants 2 times, plus the iteration in
`HoodieFileGroup`, one `contains` check needs 3 iteration, which is very
inefficient.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]