danny0405 commented on a change in pull request #4753: URL: https://github.com/apache/hudi/pull/4753#discussion_r804430279
########## File path: hudi-client/hudi-spark-client/src/main/java/org/apache/hudi/client/HoodieSparkCompactor.java ########## @@ -43,19 +48,24 @@ public HoodieSparkCompactor(BaseHoodieWriteClient<T, JavaRDD<HoodieRecord<T>>, J } @Override - public void compact(HoodieInstant instant) throws IOException { + public void compact(HoodieInstant instant) { LOG.info("Compactor executing compaction " + instant); SparkRDDWriteClient<T> writeClient = (SparkRDDWriteClient<T>) compactionClient; - JavaRDD<WriteStatus> res = writeClient.compact(instant.getTimestamp()); - this.context.setJobStatus(this.getClass().getSimpleName(), "Collect compaction write status"); - long numWriteErrors = res.collect().stream().filter(WriteStatus::hasErrors).count(); + HoodieWriteMetadata<JavaRDD<WriteStatus>> compactionMetadata = writeClient.compact(instant.getTimestamp()); + List<HoodieWriteStat> writeStats = compactionMetadata.getCommitMetadata().get() + .getPartitionToWriteStats() + .values() Review comment: Is there any possibility we add a util method named `HoodieCommitMetadata#getWriteStats` to wrap these stream lines ? I saw the similar code invoked in several places. -- 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