vinothchandar commented on a change in pull request #1924: URL: https://github.com/apache/hudi/pull/1924#discussion_r466850903
########## 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: Sounds good . @umehrot2 ---------------------------------------------------------------- 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: us...@infra.apache.org