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 2020/08/06 07:56:57 UTC

[GitHub] [hudi] vinothchandar commented on a change in pull request #1924: [HUDI-999][Performance] Parallelize fetching of bootstrap source data files/partitions

vinothchandar commented on a change in pull request #1924:
URL: https://github.com/apache/hudi/pull/1924#discussion_r466216468



##########
File path: hudi-client/src/main/java/org/apache/hudi/table/action/bootstrap/BootstrapUtils.java
##########
@@ -41,37 +48,87 @@
    * Returns leaf folders with files under a path.
    * @param fs  File System
    * @param basePathStr Base Path to look for leaf folders
-   * @param filePathFilter  Filters to skip directories/paths
+   * @param jsc Java spark context
    * @return list of partition paths with files under them.
    * @throws IOException
    */
   public static List<Pair<String, List<HoodieFileStatus>>> getAllLeafFoldersWithFiles(FileSystem fs, String basePathStr,
-                                                                                      PathFilter filePathFilter) throws IOException {
+      JavaSparkContext jsc) throws IOException {
     final Path basePath = new Path(basePathStr);
     final Map<Integer, List<String>> levelToPartitions = new HashMap<>();
     final Map<String, List<HoodieFileStatus>> partitionToFiles = new HashMap<>();
-    FSUtils.processFiles(fs, basePathStr, (status) -> {
-      if (status.isFile() && filePathFilter.accept(status.getPath())) {
-        String relativePath = FSUtils.getRelativePartitionPath(basePath, status.getPath().getParent());
-        List<HoodieFileStatus> statusList = partitionToFiles.get(relativePath);
-        if (null == statusList) {
-          Integer level = (int) relativePath.chars().filter(ch -> ch == '/').count();
-          List<String> dirs = levelToPartitions.get(level);
-          if (null == dirs) {
-            dirs = new ArrayList<>();
-            levelToPartitions.put(level, dirs);
+    PathFilter filePathFilter = getFilePathFilter();
+    PathFilter metaPathFilter = getExcludeMetaPathFilter();
+
+    FileStatus[] topLevelStatuses = fs.listStatus(new Path(basePathStr));
+    List<String> subDirectories = new ArrayList<>();
+
+    List<Pair<HoodieFileStatus, Pair<Integer, String>>> result = new ArrayList<>();

Review comment:
       we had some very similar code for marker dir listing? can we see if we can reuse some code here across them?




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

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