wuguowei1994 commented on code in PR #18750:
URL: https://github.com/apache/druid/pull/18750#discussion_r2540224025


##########
indexing-service/src/main/java/org/apache/druid/indexing/seekablestream/supervisor/SeekableStreamSupervisor.java:
##########
@@ -177,6 +178,50 @@
   // Internal data structures
   // --------------------------------------------------------
 
+  protected static class OffsetSnapshot<PartitionIdType, SequenceOffsetType>
+  {
+    private final Map<PartitionIdType, SequenceOffsetType> currentOffsets;
+    private final Map<PartitionIdType, SequenceOffsetType> endOffsets;
+
+    public OffsetSnapshot(
+        @Nullable Map<PartitionIdType, SequenceOffsetType> currentOffsets,
+        @Nullable Map<PartitionIdType, SequenceOffsetType> endOffsets
+    )
+    {
+      this.currentOffsets = toImmutableOffsetMap(currentOffsets);
+      this.endOffsets = toImmutableOffsetMap(endOffsets);
+    }
+
+    private Map<PartitionIdType, SequenceOffsetType> toImmutableOffsetMap(
+        @Nullable Map<PartitionIdType, SequenceOffsetType> input
+    )
+    {
+      if (input == null || input.isEmpty()) {
+        return Collections.emptyMap();
+      }
+
+      return input.entrySet().stream()
+                  .filter(e -> e.getValue() != null)
+                  .collect(ImmutableMap.toImmutableMap(
+                      Map.Entry::getKey,
+                      Map.Entry::getValue
+                  ));
+    }
+
+    public Map<PartitionIdType, SequenceOffsetType> getCurrentOffsets()

Review Comment:
   fixed



##########
indexing-service/src/main/java/org/apache/druid/indexing/seekablestream/supervisor/SeekableStreamSupervisor.java:
##########
@@ -177,6 +178,50 @@
   // Internal data structures
   // --------------------------------------------------------
 
+  protected static class OffsetSnapshot<PartitionIdType, SequenceOffsetType>
+  {
+    private final Map<PartitionIdType, SequenceOffsetType> currentOffsets;
+    private final Map<PartitionIdType, SequenceOffsetType> endOffsets;
+
+    public OffsetSnapshot(
+        @Nullable Map<PartitionIdType, SequenceOffsetType> currentOffsets,
+        @Nullable Map<PartitionIdType, SequenceOffsetType> endOffsets
+    )
+    {
+      this.currentOffsets = toImmutableOffsetMap(currentOffsets);
+      this.endOffsets = toImmutableOffsetMap(endOffsets);
+    }
+
+    private Map<PartitionIdType, SequenceOffsetType> toImmutableOffsetMap(
+        @Nullable Map<PartitionIdType, SequenceOffsetType> input
+    )
+    {
+      if (input == null || input.isEmpty()) {
+        return Collections.emptyMap();
+      }
+
+      return input.entrySet().stream()
+                  .filter(e -> e.getValue() != null)
+                  .collect(ImmutableMap.toImmutableMap(
+                      Map.Entry::getKey,
+                      Map.Entry::getValue
+                  ));
+    }
+
+    public Map<PartitionIdType, SequenceOffsetType> getCurrentOffsets()
+    {
+      return currentOffsets;
+    }
+
+    public Map<PartitionIdType, SequenceOffsetType> getEndOffsets()

Review Comment:
   fixed



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to