1
0

[HUDI-2737] Use earliest instant by default for async compaction and clustering jobs (#3991)

Address review comments

Fix test failures

Co-authored-by: Sagar Sumit <sagarsumit09@gmail.com>
This commit is contained in:
Y Ethan Guo
2021-11-22 17:19:41 -08:00
committed by GitHub
parent 3bdab01a49
commit 772af935d5
7 changed files with 102 additions and 27 deletions

View File

@@ -274,6 +274,12 @@ public class HoodieDefaultTimeline implements HoodieTimeline {
return Option.fromJavaOptional(instants.stream().findFirst());
}
@Override
public Option<HoodieInstant> firstInstant(String action, State state) {
return Option.fromJavaOptional(instants.stream()
.filter(s -> action.equals(s.getAction()) && state.equals(s.getState())).findFirst());
}
@Override
public Option<HoodieInstant> nthInstant(int n) {
if (empty() || n >= countInstants()) {

View File

@@ -209,6 +209,13 @@ public interface HoodieTimeline extends Serializable {
*/
Option<HoodieInstant> firstInstant();
/**
* @param action Instant action String.
* @param state Instant State.
* @return first instant of a specific action and state if available
*/
Option<HoodieInstant> firstInstant(String action, State state);
/**
* @return nth completed instant from the first completed instant
*/