codope commented on code in PR #19464:
URL: https://github.com/apache/hudi/pull/19464#discussion_r3709592793


##########
hudi-common/src/main/java/org/apache/hudi/common/util/ClusteringUtils.java:
##########
@@ -121,14 +121,18 @@ public static Option<HoodieInstant> 
getRequestedClusteringInstant(String timesta
   /**
    * Transitions the provided clustering instant fron inflight to complete 
based on the clustering
    * action type. After HUDI-7905, the new clustering commits are written with 
clustering action.
+   *
+   * @return the completed instant, whose action is the one recorded on the 
timeline. This differs
+   *         from the inflight action: a {@code clustering} inflight instant 
completes as
+   *         {@code replacecommit}.
    */
-  public static <T> void 
transitionClusteringOrReplaceInflightToComplete(boolean shouldLock, 
HoodieInstant clusteringInstant,
-                                                                         
HoodieReplaceCommitMetadata metadata, HoodieActiveTimeline activeTimeline,
-                                                                         
TableFormatCompletionAction tableFormatCompletionAction) {
+  public static <T> HoodieInstant 
transitionClusteringOrReplaceInflightToComplete(boolean shouldLock, 
HoodieInstant clusteringInstant,
+                                                                               
   HoodieReplaceCommitMetadata metadata, HoodieActiveTimeline activeTimeline,
+                                                                               
   TableFormatCompletionAction tableFormatCompletionAction) {
     if 
(clusteringInstant.getAction().equals(HoodieTimeline.CLUSTERING_ACTION)) {
-      activeTimeline.transitionClusterInflightToComplete(shouldLock, 
clusteringInstant, metadata, tableFormatCompletionAction);
+      return activeTimeline.transitionClusterInflightToComplete(shouldLock, 
clusteringInstant, metadata, tableFormatCompletionAction);

Review Comment:
   `TestClusteringUtils`: added the action assertion at the existing 
transition, plus 
`testTransitionInflightToCompleteReturnsCompletedReplaceCommit`, which calls 
`transitionClusteringOrReplaceInflightToComplete` directly for both inflight 
kinds and asserts `replacecommit` for each, so the `else` branch is covered 
too. It also asserts that the table-format hook is handed the same instant that 
is returned.



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