danny0405 commented on code in PR #12601:
URL: https://github.com/apache/hudi/pull/12601#discussion_r1915980851


##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/table/action/cluster/strategy/PartitionAwareClusteringPlanStrategy.java:
##########
@@ -131,36 +138,74 @@ public Option<HoodieClusteringPlan> 
generateClusteringPlan() {
 
     String partitionSelected = config.getClusteringPartitionSelected();
     LOG.info("Scheduling clustering partitionSelected: {}", partitionSelected);
-    List<String> partitionPaths;
+    List<String> partitionPaths = new ArrayList<>();
+    List<String> missingPartitions = new ArrayList<>();
+    List<HoodieClusteringGroup> clusteringGroups;
+    int clusteringMaxNumGroups = getWriteConfig().getClusteringMaxNumGroups();
 
     if (StringUtils.isNullOrEmpty(partitionSelected)) {
       // get matched partitions if set
-      partitionPaths = getRegexPatternMatchedPartitions(config, 
FSUtils.getAllPartitionPaths(
-          getEngineContext(), metaClient.getStorage(), 
config.getMetadataConfig(), metaClient.getBasePath()));
+      partitionPaths = getRegexPatternMatchedPartitions(config, 
partitions.get());
       // filter the partition paths if needed to reduce list status
     } else {
       partitionPaths = Arrays.asList(partitionSelected.split(","));
+      // Users may temporarily set specific partitions for clustering.
+      // Ensure the coherence of the missing partitions.
+      missingPartitions = 
(List<String>)executor.fetchMissingPartitions(TableServiceType.CLUSTER).getRight();
     }
 
-    partitionPaths = filterPartitionPaths(partitionPaths);
+    Pair<List<String>, List<String>> partitionsPair = 
filterPartitionPaths(getWriteConfig(), partitionPaths);
+    partitionPaths = partitionsPair.getLeft();
+    missingPartitions.addAll(partitionsPair.getRight());
     LOG.info("Scheduling clustering partitionPaths: {}", partitionPaths);
+    LOG.info("Missing Scheduled clustering partitionPaths: {}", 
missingPartitions);
 
     if (partitionPaths.isEmpty()) {
       // In case no partitions could be picked, return no clustering plan
       return Option.empty();
     }
 
-    List<HoodieClusteringGroup> clusteringGroups = getEngineContext()
-        .flatMap(
-            partitionPaths,
-            partitionPath -> {
-              List<FileSlice> fileSlicesEligible = 
getFileSlicesEligibleForClustering(partitionPath).collect(Collectors.toList());
-              return buildClusteringGroupsForPartition(partitionPath, 
fileSlicesEligible).limit(getWriteConfig().getClusteringMaxNumGroups());
-            },
-            partitionPaths.size())
-        .stream()
-        .limit(getWriteConfig().getClusteringMaxNumGroups())
-        .collect(Collectors.toList());
+    List<Pair<List<HoodieClusteringGroup>, String>> res = 
getEngineContext().map(partitionPaths, partitionPath -> {
+      List<FileSlice> fileSlicesEligible = 
getFileSlicesEligibleForClustering(partitionPath).collect(Collectors.toList());
+      Pair<Stream<HoodieClusteringGroup>, Boolean> groupPair = 
buildClusteringGroupsForPartition(partitionPath, fileSlicesEligible);
+      List<HoodieClusteringGroup> clusteringGroupsPartition = 
groupPair.getLeft().collect(Collectors.toList());
+      Boolean allProcessed = groupPair.getRight();

Review Comment:
   partialScheduled?



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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to