the-other-tim-brown commented on code in PR #9337:
URL: https://github.com/apache/hudi/pull/9337#discussion_r1281245951


##########
hudi-common/src/main/java/org/apache/hudi/common/model/HoodieBaseFile.java:
##########
@@ -52,14 +59,39 @@ public HoodieBaseFile(String filePath) {
   public HoodieBaseFile(String filePath, BaseFile bootstrapBaseFile) {
     super(filePath);
     this.bootstrapBaseFile = Option.ofNullable(bootstrapBaseFile);
+    String[] fileIdAndCommitTime = getFileIdAndCommitTimeFromFileName();
+    this.fileId = fileIdAndCommitTime[0];
+    this.commitTime = fileIdAndCommitTime[1];
+  }
+
+  private String[] getFileIdAndCommitTimeFromFileName() {
+    String[] values = new String[2];
+    short underscoreCount = 0;
+    short lastUnderscoreIndex = 0;
+    for (int i = 0; i < fileName.length(); i++) {
+      char c = fileName.charAt(i);
+      if (c == '_') {
+        if (underscoreCount == 0) {
+          values[0] = fileName.substring(0, i);
+        }
+        lastUnderscoreIndex = (short) i;
+        underscoreCount++;
+      } else if (c == '.') {
+        if (underscoreCount == 2) {
+          values[1] = fileName.substring(lastUnderscoreIndex + 1, i);
+          break;
+        }
+      }
+    }
+    return values;

Review Comment:
   I don't think we strictly require file IDs to be a UUID so I don't think 
this will work. It will require multiple traversals of the string which is what 
I was trying to avoid.



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

Reply via email to