nsivabalan commented on code in PR #10619:
URL: https://github.com/apache/hudi/pull/10619#discussion_r1484932647


##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/table/action/compact/HoodieCompactor.java:
##########
@@ -239,18 +240,25 @@ public List<WriteStatus> compact(HoodieCompactionHandler 
compactionHandler,
     scanner.close();
     Iterable<List<WriteStatus>> resultIterable = () -> result;
     return StreamSupport.stream(resultIterable.spliterator(), 
false).flatMap(Collection::stream).peek(s -> {
-      
s.getStat().setTotalUpdatedRecordsCompacted(scanner.getNumMergedRecordsInLog());
-      s.getStat().setTotalLogFilesCompacted(scanner.getTotalLogFiles());
-      s.getStat().setTotalLogRecords(scanner.getTotalLogRecords());
-      s.getStat().setPartitionPath(operation.getPartitionPath());
-      s.getStat()
+      final HoodieWriteStat stat = s.getStat();
+      stat.setTotalUpdatedRecordsCompacted(scanner.getNumMergedRecordsInLog());
+      stat.setTotalLogFilesCompacted(scanner.getTotalLogFiles());
+      stat.setTotalLogRecords(scanner.getTotalLogRecords());
+      stat.setPartitionPath(operation.getPartitionPath());
+      stat
           
.setTotalLogSizeCompacted(operation.getMetrics().get(CompactionStrategy.TOTAL_LOG_FILE_SIZE).longValue());
-      s.getStat().setTotalLogBlocks(scanner.getTotalLogBlocks());
-      s.getStat().setTotalCorruptLogBlock(scanner.getTotalCorruptBlocks());
-      s.getStat().setTotalRollbackBlocks(scanner.getTotalRollbacks());
+      stat.setTotalLogBlocks(scanner.getTotalLogBlocks());
+      stat.setTotalCorruptLogBlock(scanner.getTotalCorruptBlocks());
+      stat.setTotalRollbackBlocks(scanner.getTotalRollbacks());
       RuntimeStats runtimeStats = new RuntimeStats();
+      // scan time has to be obtained from scanner.
       
runtimeStats.setTotalScanTime(scanner.getTotalTimeTakenToReadAndMergeBlocks());
-      s.getStat().setRuntimeStats(runtimeStats);
+      // create and upsert time are obtained from the create or merge handle.
+      if (stat.getRuntimeStats() != null) {
+        
runtimeStats.setTotalCreateTime(stat.getRuntimeStats().getTotalCreateTime());
+        
runtimeStats.setTotalUpsertTime(stat.getRuntimeStats().getTotalUpsertTime());

Review Comment:
   +1 



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