This is an automated email from the ASF dual-hosted git repository.

yihua pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hudi.git


The following commit(s) were added to refs/heads/master by this push:
     new 64310f57b06 [MINOR] Expose filename when getting commit time from 
illegal filename (#9304)
64310f57b06 is described below

commit 64310f57b06a40c8dbd1637989015e05f7039609
Author: Shawn Chang <[email protected]>
AuthorDate: Fri Jul 28 10:31:40 2023 -0700

    [MINOR] Expose filename when getting commit time from illegal filename 
(#9304)
    
    Co-authored-by: Shawn Chang <[email protected]>
---
 .../src/main/java/org/apache/hudi/common/fs/FSUtils.java       | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/hudi-common/src/main/java/org/apache/hudi/common/fs/FSUtils.java 
b/hudi-common/src/main/java/org/apache/hudi/common/fs/FSUtils.java
index a6146745b2b..234af8a7be3 100644
--- a/hudi-common/src/main/java/org/apache/hudi/common/fs/FSUtils.java
+++ b/hudi-common/src/main/java/org/apache/hudi/common/fs/FSUtils.java
@@ -191,10 +191,14 @@ public class FSUtils {
   }
 
   public static String getCommitTime(String fullFileName) {
-    if (isLogFile(fullFileName)) {
-      return fullFileName.split("_")[1].split("\\.")[0];
+    try {
+      if (isLogFile(fullFileName)) {
+        return fullFileName.split("_")[1].split("\\.")[0];
+      }
+      return fullFileName.split("_")[2].split("\\.")[0];
+    } catch (ArrayIndexOutOfBoundsException e) {
+      throw new HoodieException("Failed to get commit time from filename: " + 
fullFileName, e);
     }
-    return fullFileName.split("_")[2].split("\\.")[0];
   }
 
   public static long getFileSize(FileSystem fs, Path path) throws IOException {

Reply via email to