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

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

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


##########
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:
   why we need outputRow, 
   how about return allInstants.map(p => Row(client.rollback(p.getTimestamp), p.getTimestamp))  directly



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