You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hudi.apache.org by ga...@apache.org on 2021/05/10 13:48:14 UTC

[hudi] branch master updated: [MINOR] optimize FilePathUtils (#2931)

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

garyli 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 511ac48  [MINOR] optimize FilePathUtils (#2931)
511ac48 is described below

commit 511ac4881d6bf3385fd98946594aae16088047f1
Author: hiscat <46...@users.noreply.github.com>
AuthorDate: Mon May 10 21:47:56 2021 +0800

    [MINOR] optimize FilePathUtils (#2931)
---
 .../org/apache/hudi/table/format/FilePathUtils.java | 21 +++------------------
 1 file changed, 3 insertions(+), 18 deletions(-)

diff --git a/hudi-flink/src/main/java/org/apache/hudi/table/format/FilePathUtils.java b/hudi-flink/src/main/java/org/apache/hudi/table/format/FilePathUtils.java
index 4dfe990..0623eb9 100644
--- a/hudi-flink/src/main/java/org/apache/hudi/table/format/FilePathUtils.java
+++ b/hudi-flink/src/main/java/org/apache/hudi/table/format/FilePathUtils.java
@@ -132,21 +132,6 @@ public class FilePathUtils {
   }
 
   /**
-   * Generates partition values from path.
-   *
-   * @param currPath      Partition file path
-   * @param hivePartition Whether the partition path is with Hive style
-   * @param partitionKeys Partition keys
-   * @return Sequential partition specs.
-   */
-  public static List<String> extractPartitionValues(
-      Path currPath,
-      boolean hivePartition,
-      String[] partitionKeys) {
-    return new ArrayList<>(extractPartitionKeyValues(currPath, hivePartition, partitionKeys).values());
-  }
-
-  /**
    * Generates partition key value mapping from path.
    *
    * @param currPath      Partition file path
@@ -265,7 +250,7 @@ public class FilePathUtils {
       return;
     }
 
-    if (fileStatus.isDir() && !isHiddenFile(fileStatus)) {
+    if (fileStatus.isDirectory() && !isHiddenFile(fileStatus)) {
       for (FileStatus stat : fs.listStatus(fileStatus.getPath())) {
         listStatusRecursively(fs, stat, level + 1, expectLevel, results);
       }
@@ -275,7 +260,7 @@ public class FilePathUtils {
   private static boolean isHiddenFile(FileStatus fileStatus) {
     String name = fileStatus.getPath().getName();
     // the log files is hidden file
-    return name.startsWith("_") || name.startsWith(".") && !name.contains(".log.");
+    return name.startsWith("_") || (name.startsWith(".") && !name.contains(".log."));
   }
 
   /**
@@ -393,7 +378,7 @@ public class FilePathUtils {
    */
   public static org.apache.flink.core.fs.Path[] toFlinkPaths(Path[] paths) {
     return Arrays.stream(paths)
-        .map(p -> toFlinkPath(p))
+        .map(FilePathUtils::toFlinkPath)
         .toArray(org.apache.flink.core.fs.Path[]::new);
   }