EMsnap commented on code in PR #8367:
URL: https://github.com/apache/inlong/pull/8367#discussion_r1246318277


##########
inlong-sort/sort-flink/sort-flink-v1.13/sort-connectors/iceberg/src/main/java/org/apache/inlong/sort/iceberg/sink/multiple/IcebergSingleFileCommiter.java:
##########
@@ -423,4 +482,50 @@ static long getMaxCommittedCheckpointId(Table table, 
String flinkJobId) {
 
         return lastCommittedCheckpointId;
     }
+
+    static long getSnapshotIdAssociatedWithChkId(Table table, String 
flinkJobId, Long checkpointId) {
+        Snapshot snapshot = table.currentSnapshot();
+        long associatedSnapshotId = INVALID_SNAPSHOT_ID;
+
+        while (snapshot != null) {
+            Map<String, String> summary = snapshot.summary();
+            String snapshotFlinkJobId = summary.get(FLINK_JOB_ID);
+            if (flinkJobId.equals(snapshotFlinkJobId)) {
+                String value = summary.get(MAX_COMMITTED_CHECKPOINT_ID);
+                if (value != null && 
checkpointId.equals(Long.parseLong(value))) {
+                    associatedSnapshotId = snapshot.snapshotId();
+                    break;
+                }
+            }
+            Long parentSnapshotId = snapshot.parentId();
+            snapshot = parentSnapshotId != null ? 
table.snapshot(parentSnapshotId) : null;
+        }
+        return associatedSnapshotId;
+    }
+
+    static long findLastCommittedManifest(NavigableMap<Long, byte[]> 
deltaManifestsMap, FileIO io) throws IOException {
+        List<Long> uncommittedChkList = deltaManifestsMap.keySet()
+            .stream()
+            .sorted((a, b) -> a < b ? 1 : ((a == b) ? 0 : -1))

Review Comment:
   lambda can be simplified to
   .sorted(Comparator.reverseOrder())



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