danny0405 commented on code in PR #7627:
URL: https://github.com/apache/hudi/pull/7627#discussion_r1065348765


##########
hudi-common/src/main/java/org/apache/hudi/common/table/timeline/HoodieInstant.java:
##########
@@ -46,14 +55,35 @@ public class HoodieInstant implements Serializable, 
Comparable<HoodieInstant> {
   public static final Comparator<HoodieInstant> COMPARATOR = 
Comparator.comparing(HoodieInstant::getTimestamp)
       .thenComparing(ACTION_COMPARATOR).thenComparing(HoodieInstant::getState);
 
+  public static final Comparator<HoodieInstant> STATE_TRANSITION_COMPARATOR =
+      Comparator.comparing(HoodieInstant::getStateTransitionTime)
+          .thenComparing(HoodieInstant::getTimestamp)
+          
.thenComparing(ACTION_COMPARATOR).thenComparing(HoodieInstant::getState);
+
   public static String getComparableAction(String action) {
     return COMPARABLE_ACTIONS.getOrDefault(action, action);
   }
 
+  public static String extractTimestamp(String fileName) throws 
IllegalArgumentException {
+    Objects.requireNonNull(fileName);
+
+    Matcher matcher = NAME_FORMAT.matcher(fileName);
+    if (matcher.find()) {
+      return matcher.group(1);
+    }
+
+    throw new IllegalArgumentException(String.format(FILE_NAME_FORMAT_ERROR, 
fileName));
+  }
+
   public static String getTimelineFileExtension(String fileName) {
     Objects.requireNonNull(fileName);
-    int dotIndex = fileName.indexOf('.');
-    return dotIndex == -1 ? "" : fileName.substring(dotIndex);
+
+    Matcher matcher = NAME_FORMAT.matcher(fileName);

Review Comment:
   Is the regex expr match efficient enough here ?



-- 
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]

Reply via email to