You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hudi.apache.org by "SteNicholas (via GitHub)" <gi...@apache.org> on 2023/02/24 06:12:04 UTC

[GitHub] [hudi] SteNicholas commented on a diff in pull request #8024: [MINOR] Improve RollbackToInstantTimeProcedure

SteNicholas commented on code in PR #8024:
URL: https://github.com/apache/hudi/pull/8024#discussion_r1116542929


##########
hudi-spark-datasource/hudi-spark/src/main/scala/org/apache/spark/sql/hudi/command/procedures/RollbackToInstantTimeProcedure.scala:
##########
@@ -73,10 +73,14 @@ class RollbackToInstantTimeProcedure extends BaseProcedure with ProcedureBuilder
         throw new HoodieException(s"Commit $instantTime not found in Commits $completedTimeline")
       }
 
-      val result = if (client.rollback(instantTime)) true else false
-      val outputRow = Row(result)
+      val outputRow = new util.ArrayList[Row]
+      val allInstants: List[HoodieInstant] = completedTimeline
+        .findInstantsAfterOrEquals(instantTime, Integer.MAX_VALUE).getReverseOrderedInstants.toArray()
+        .map(r => r.asInstanceOf[HoodieInstant]).toList
 
-      Seq(outputRow)
+      allInstants.foreach(p => outputRow.add(Row(client.rollback(p.getTimestamp), p.getTimestamp)))

Review Comment:
   The request argument of `rollback_to_instant` has the `instant_time`, therefore the return result doesn't need the `instant_time`.



-- 
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-unsubscribe@hudi.apache.org

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