nsivabalan commented on code in PR #11562:
URL: https://github.com/apache/hudi/pull/11562#discussion_r1664606234
##########
hudi-common/src/main/java/org/apache/hudi/common/table/timeline/HoodieInstant.java:
##########
@@ -117,23 +123,35 @@ public HoodieInstant(StoragePathInfo pathInfo) {
String fileName = pathInfo.getPath().getName();
Matcher matcher = NAME_FORMAT.matcher(fileName);
if (matcher.find()) {
- timestamp = matcher.group(1);
- if (matcher.group(2).equals(HoodieTimeline.INFLIGHT_EXTENSION)) {
+ String[] timestamps = matcher.group(1).split(UNDERSCORE);
+ timestamp = timestamps[0];
+ if (matcher.group(3).equals(HoodieTimeline.INFLIGHT_EXTENSION)) {
// 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 = HoodieTimeline.COMMIT_ACTION;
state = State.INFLIGHT;
} else {
- action = matcher.group(2).replaceFirst(DELIMITER,
StringUtils.EMPTY_STRING);
- if (matcher.groupCount() == 3 && matcher.group(3) != null) {
- state = State.valueOf(matcher.group(3).replaceFirst(DELIMITER,
StringUtils.EMPTY_STRING).toUpperCase());
+ action = matcher.group(3).replaceFirst(DELIMITER,
StringUtils.EMPTY_STRING);
+ if (matcher.groupCount() == 4 && matcher.group(4) != null) {
+ state = State.valueOf(matcher.group(4).replaceFirst(DELIMITER,
StringUtils.EMPTY_STRING).toUpperCase());
} else {
// Like 20230104152218702.commit
state = State.COMPLETED;
}
}
- stateTransitionTime =
- HoodieInstantTimeGenerator.formatDate(new
Date(pathInfo.getModificationTime()));
+ // fallback to last mod time if completion time is missing.
+ //completionTime = timestamps.length > 1 ? timestamps[1]
+ // : ((state == State.COMPLETED) ?
HoodieInstantTimeGenerator.formatDate(new
Date(pathInfo.getModificationTime())): null);
+ if (timestamps.length > 1) {
+ completionTime = timestamps[1];
+ } else {
+ if (state == State.COMPLETED) {
+ completionTime = HoodieInstantTimeGenerator.formatDate(new
Date(pathInfo.getModificationTime()));
Review Comment:
falling back to last mod time if completion time is missing
##########
hudi-common/src/main/java/org/apache/hudi/common/table/timeline/HoodieInstant.java:
##########
@@ -117,23 +123,35 @@ public HoodieInstant(StoragePathInfo pathInfo) {
String fileName = pathInfo.getPath().getName();
Matcher matcher = NAME_FORMAT.matcher(fileName);
if (matcher.find()) {
- timestamp = matcher.group(1);
- if (matcher.group(2).equals(HoodieTimeline.INFLIGHT_EXTENSION)) {
+ String[] timestamps = matcher.group(1).split(UNDERSCORE);
+ timestamp = timestamps[0];
+ if (matcher.group(3).equals(HoodieTimeline.INFLIGHT_EXTENSION)) {
// 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 = HoodieTimeline.COMMIT_ACTION;
state = State.INFLIGHT;
} else {
- action = matcher.group(2).replaceFirst(DELIMITER,
StringUtils.EMPTY_STRING);
- if (matcher.groupCount() == 3 && matcher.group(3) != null) {
- state = State.valueOf(matcher.group(3).replaceFirst(DELIMITER,
StringUtils.EMPTY_STRING).toUpperCase());
+ action = matcher.group(3).replaceFirst(DELIMITER,
StringUtils.EMPTY_STRING);
+ if (matcher.groupCount() == 4 && matcher.group(4) != null) {
+ state = State.valueOf(matcher.group(4).replaceFirst(DELIMITER,
StringUtils.EMPTY_STRING).toUpperCase());
} else {
// Like 20230104152218702.commit
state = State.COMPLETED;
}
}
- stateTransitionTime =
- HoodieInstantTimeGenerator.formatDate(new
Date(pathInfo.getModificationTime()));
+ // fallback to last mod time if completion time is missing.
+ //completionTime = timestamps.length > 1 ? timestamps[1]
+ // : ((state == State.COMPLETED) ?
HoodieInstantTimeGenerator.formatDate(new
Date(pathInfo.getModificationTime())): null);
+ if (timestamps.length > 1) {
+ completionTime = timestamps[1];
+ } else {
+ if (state == State.COMPLETED) {
+ completionTime = HoodieInstantTimeGenerator.formatDate(new
Date(pathInfo.getModificationTime()));
Review Comment:
NTR: falling back to last mod time if completion time is missing
--
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]