lw309637554 commented on a change in pull request #3259:
URL: https://github.com/apache/hudi/pull/3259#discussion_r675270601



##########
File path: 
hudi-utilities/src/main/java/org/apache/hudi/utilities/HoodieClusteringJob.java
##########
@@ -164,11 +196,37 @@ private int doCluster(JavaSparkContext jsc) throws 
Exception {
   private Option<String> doSchedule(JavaSparkContext jsc) throws Exception {
     String schemaStr = getSchemaFromLatestInstant();
     try (SparkRDDWriteClient<HoodieRecordPayload> client = 
UtilHelpers.createHoodieClient(jsc, cfg.basePath, schemaStr, cfg.parallelism, 
Option.empty(), props)) {
-      if (cfg.clusteringInstantTime != null) {
-        client.scheduleClusteringAtInstant(cfg.clusteringInstantTime, 
Option.empty());
-        return Option.of(cfg.clusteringInstantTime);
+      return doSchedule(client);
+    }
+  }
+
+  private Option<String> doSchedule(SparkRDDWriteClient<HoodieRecordPayload> 
client) {
+    if (cfg.clusteringInstantTime != null) {
+      client.scheduleClusteringAtInstant(cfg.clusteringInstantTime, 
Option.empty());
+      return Option.of(cfg.clusteringInstantTime);
+    }
+    return client.scheduleClustering(Option.empty());
+  }
+
+  public int doScheduleAndCluster(JavaSparkContext jsc) throws Exception {
+    LOG.info("Step 1: Do schedule");
+    String schemaStr = getSchemaFromLatestInstant();
+    try (SparkRDDWriteClient<HoodieRecordPayload> client = 
UtilHelpers.createHoodieClient(jsc, cfg.basePath, schemaStr, cfg.parallelism, 
Option.empty(), props)) {
+
+      Option<String> instantTime = doSchedule(client);
+      int result = instantTime.isPresent() ? 0 : -1;
+
+      if (result == -1) {
+        LOG.info("Couldn't Generate Cluster Plan");

Review comment:
       Couldn't Generate Cluster Plan -> Couldn't generate cluster plan




-- 
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: commits-unsubscr...@hudi.apache.org

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


Reply via email to