You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hudi.apache.org by GitBox <gi...@apache.org> on 2022/06/14 03:58:09 UTC

[GitHub] [hudi] danny0405 commented on a diff in pull request #5859: [MINOR] fix file not exists for getFileSize

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


##########
hudi-common/src/main/java/org/apache/hudi/common/fs/FSUtils.java:
##########
@@ -189,7 +189,11 @@ public static String getCommitTime(String fullFileName) {
   }
 
   public static long getFileSize(FileSystem fs, Path path) throws IOException {
-    return fs.getFileStatus(path).getLen();
+    if (fs.exists(path)) {
+      return fs.getFileStatus(path).getLen();
+    } else {
+      return 0L;
+    }

Review Comment:
   What is the context here ? Can we ensure the file must exist when calling the `getFileSize`



-- 
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-unsubscribe@hudi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org