pnowojski commented on code in PR #23908:
URL: https://github.com/apache/flink/pull/23908#discussion_r1441683484


##########
flink-runtime/src/main/java/org/apache/flink/runtime/checkpoint/CheckpointStatsTracker.java:
##########
@@ -155,7 +167,12 @@ public CheckpointStatsSnapshot createSnapshot() {
                                 counts.createSnapshot(),
                                 summary.createSnapshot(),
                                 history.createSnapshot(),
-                                latestRestoredCheckpoint);
+                                jobInitializationMetricsBuilder
+                                        .map(
+                                                JobInitializationMetricsBuilder
+                                                        
::buildRestoredCheckpointStats)
+                                        .orElse(Optional.empty())
+                                        .orElse(null));

Review Comment:
   Because
   1. builder can be empty
   2. if it's not empty,  `buildRestoredCheckpointStats` can also return empty 
result
   
   This is an equivalent of
   ```
   if (builder.isEmpty()) {
     return null;
   }
   Optional<Stats> stats = builder.get().buildRestoredCheckpointStats();
   return stats.orElse(null);
   ```
   
   Because of that `map` here returns `Optional<Optional<...>>` 



-- 
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: issues-unsubscr...@flink.apache.org

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

Reply via email to