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


##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/table/action/cluster/ClusteringPlanActionExecutor.java:
##########
@@ -48,21 +48,28 @@
   private final Option<Map<String, String>> extraMetadata;
 
   public ClusteringPlanActionExecutor(HoodieEngineContext context,
-                                          HoodieWriteConfig config,
-                                          HoodieTable<T, I, K, O> table,
-                                          String instantTime,
-                                          Option<Map<String, String>> 
extraMetadata) {
+                                      HoodieWriteConfig config,
+                                      HoodieTable<T, I, K, O> table,
+                                      String instantTime,
+                                      Option<Map<String, String>> 
extraMetadata) {
     super(context, config, table, instantTime);
     this.extraMetadata = extraMetadata;
   }
 
   protected Option<HoodieClusteringPlan> createClusteringPlan() {
     LOG.info("Checking if clustering needs to be run on " + 
config.getBasePath());
-    Option<HoodieInstant> lastClusteringInstant = 
table.getActiveTimeline().getCompletedReplaceTimeline().lastInstant();
+    Option<HoodieInstant> lastClusteringInstant;
+    Option<HoodieInstant> pendingInstant = 
table.getActiveTimeline().filterPendingReplaceTimeline().lastInstant();
+    if (pendingInstant.isPresent()) {

Review Comment:
   ```java
   table.getActiveTimeline().getInstants.()stream().filter(
           s -> s.getAction().equals(HoodieTimeline.REPLACE_COMMIT_ACTION)
   ```
   
   guess we can filter the instants directly by the action type here ?



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