hudi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [incubator-hudi] vinothchandar commented on a change in pull request #1421: [HUDI-724] Parallelize getSmallFiles for partitions
Date Fri, 20 Mar 2020 02:11:43 GMT
vinothchandar commented on a change in pull request #1421: [HUDI-724] Parallelize getSmallFiles
for partitions
URL: https://github.com/apache/incubator-hudi/pull/1421#discussion_r395410649
 
 

 ##########
 File path: hudi-client/src/main/java/org/apache/hudi/table/HoodieCopyOnWriteTable.java
 ##########
 @@ -602,18 +602,39 @@ private int addUpdateBucket(String fileIdHint) {
       return bucket;
     }
 
-    private void assignInserts(WorkloadProfile profile) {
+    private void assignInserts(WorkloadProfile profile, JavaSparkContext jsc) {
       // for new inserts, compute buckets depending on how many records we have for each
partition
       Set<String> partitionPaths = profile.getPartitionPaths();
       long averageRecordSize =
           averageBytesPerRecord(metaClient.getActiveTimeline().getCommitTimeline().filterCompletedInstants(),
               config.getCopyOnWriteRecordSizeEstimate());
       LOG.info("AvgRecordSize => " + averageRecordSize);
+
+      HashMap<String, List<SmallFile>> partitionSmallFilesMap = new HashMap<>();
+      if (jsc != null && partitionPaths.size() > 1) {
+        //Parellelize the GetSmallFile Operation by using RDDs
+        List<String> partitionPathsList = new ArrayList<>(partitionPaths);
+        JavaRDD<String> partitionPathRdds = jsc.parallelize(partitionPathsList, partitionPathsList.size());
+        List<Tuple2<String, List<SmallFile>>> partitionSmallFileTuples
=
+                partitionPathRdds.map(it -> new Tuple2<String, List<SmallFile>>(it,
getSmallFiles(it))).collect();
+
+        for (Tuple2<String, List<SmallFile>> tuple : partitionSmallFileTuples)
{
+          partitionSmallFilesMap.put(tuple._1, tuple._2);
+        }
+      }
+
       for (String partitionPath : partitionPaths) {
         WorkloadStat pStat = profile.getWorkloadStat(partitionPath);
         if (pStat.getNumInserts() > 0) {
 
-          List<SmallFile> smallFiles = getSmallFiles(partitionPath);
+          List<SmallFile> smallFiles;
+          if (partitionSmallFilesMap.isEmpty()) {
 
 Review comment:
   Can we change that code so that it always lists in parallel.. i.e no need for the fallback
in this if block... 
   

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


With regards,
Apache Git Services

Mime
View raw message