prashantwason commented on a change in pull request #2701: URL: https://github.com/apache/hudi/pull/2701#discussion_r663174457
########## File path: hudi-common/src/main/java/org/apache/hudi/common/table/timeline/HoodieInstant.java ########## @@ -71,46 +72,75 @@ public static String getTimelineFileExtension(String fileName) { INVALID } - private State state = State.COMPLETED; + public static class InstantTime { + + private String actionStartTimestamp; + private String stateTransitionTime; + + private InstantTime(String stateTransitionTime) { + this.actionStartTimestamp = stateTransitionTime; + } + + private InstantTime(String actionStartTimestamp, String stateTransitionTime) { + this.actionStartTimestamp = actionStartTimestamp; + this.stateTransitionTime = stateTransitionTime; + } + + public static InstantTime from(String actionStartTimestamp) { + return new InstantTime(actionStartTimestamp); + } + + public static InstantTime from(String actionStartTimestamp, String stateTransitionTime) { + return new InstantTime(actionStartTimestamp, stateTransitionTime); + } + + public String getActionStartTimestamp() { + return actionStartTimestamp; + } + + public String getStateTransitionTime() { + return stateTransitionTime; + } + } + + private State state; private String action; - private String timestamp; + private InstantTime instantTime; /** * Load the instant from the meta FileStatus. */ public HoodieInstant(FileStatus fileStatus) { - // First read the instant timestamp. [==>20170101193025<==].commit - String fileName = fileStatus.getPath().getName(); - String fileExtension = getTimelineFileExtension(fileName); - timestamp = fileName.replace(fileExtension, ""); - - // Next read the action for this marker - action = fileExtension.replaceFirst(".", ""); - if (action.equals("inflight")) { - // This is to support backwards compatibility on how in-flight commit files were written - // General rule is inflight extension is .<action>.inflight, but for commit it is .inflight - action = "commit"; - state = State.INFLIGHT; - } else if (action.contains(HoodieTimeline.INFLIGHT_EXTENSION)) { - state = State.INFLIGHT; - action = action.replace(HoodieTimeline.INFLIGHT_EXTENSION, ""); - } else if (action.contains(HoodieTimeline.REQUESTED_EXTENSION)) { - state = State.REQUESTED; - action = action.replace(HoodieTimeline.REQUESTED_EXTENSION, ""); - } + this.action = HoodieInstantFormat.getInstantFormat(TimelineLayoutVersion.CURR_LAYOUT_VERSION).getAction(fileStatus); Review comment: this(fileStatus, TimelineLayoutVersion.CURR_LAYOUT_VERSION) -- 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: commits-unsubscr...@hudi.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org