xuzifu666 commented on code in PR #9988:
URL: https://github.com/apache/hudi/pull/9988#discussion_r1384544659
##########
hudi-spark-datasource/hudi-spark/src/main/scala/org/apache/spark/sql/hudi/command/procedures/ShowSavepointsProcedure.scala:
##########
@@ -54,7 +56,11 @@ class ShowSavepointsProcedure extends BaseProcedure with
ProcedureBuilder {
val commits: util.List[HoodieInstant] =
timeline.getReverseOrderedInstants.collect(Collectors.toList[HoodieInstant])
if (commits.isEmpty) Seq.empty[Row] else {
- commits.toArray.map(instant =>
instant.asInstanceOf[HoodieInstant].getTimestamp).map(p => Row(p)).toSeq
+ if (limit.isDefined) {
+
commits.stream().limit(limit.get.asInstanceOf[Int]).toArray.map(instant =>
instant.asInstanceOf[HoodieInstant].getTimestamp).map(p => Row(p)).toSeq
Review Comment:
I try to refactor the code for abstracting out limit in parent class,but
seems not fit,because would get parameter from sub-class and cannot confirm the
order of limit,so I add ut first. at the same time, show procedure commands are
not much.
##########
hudi-spark-datasource/hudi-spark/src/main/scala/org/apache/spark/sql/hudi/command/procedures/ShowSavepointsProcedure.scala:
##########
@@ -54,7 +56,11 @@ class ShowSavepointsProcedure extends BaseProcedure with
ProcedureBuilder {
val commits: util.List[HoodieInstant] =
timeline.getReverseOrderedInstants.collect(Collectors.toList[HoodieInstant])
if (commits.isEmpty) Seq.empty[Row] else {
- commits.toArray.map(instant =>
instant.asInstanceOf[HoodieInstant].getTimestamp).map(p => Row(p)).toSeq
+ if (limit.isDefined) {
+
commits.stream().limit(limit.get.asInstanceOf[Int]).toArray.map(instant =>
instant.asInstanceOf[HoodieInstant].getTimestamp).map(p => Row(p)).toSeq
Review Comment:
I try to refactor the code for abstracting out limit in parent class,but
seems not fit,because would get parameter from sub-class and cannot confirm the
order of limit,so I add ut first. at the same time, show procedure commands are
not much.
--
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]