CTTY commented on code in PR #6882:
URL: https://github.com/apache/hudi/pull/6882#discussion_r1037627383


##########
hudi-common/src/main/java/org/apache/hudi/common/fs/FSUtils.java:
##########
@@ -195,8 +196,16 @@ public static long getFileSize(FileSystem fs, Path path) 
throws IOException {
     return fs.getFileStatus(path).getLen();
   }
 
+  public static long getFileSizeWithStorageStrategy(FileSystem fs, 
HoodieStorageStrategy storageStrategy,
+      String partitionPath, String fileId) throws IOException {
+    return fs.getFileStatus(new 
Path(storageStrategy.storageLocation(partitionPath, fileId))).getLen();
+  }
+
   public static String getFileId(String fullFileName) {
-    return fullFileName.split("_")[0];
+    String firstPart = fullFileName.split("_")[0];
+    return firstPart.startsWith(".")
+        ? firstPart.substring(1)
+        : firstPart;

Review Comment:
   This change is because log files ususally start with `.`. And calling this 
method to get file IDs from log files would return invalid file IDs



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