kfaraz commented on code in PR #13380:
URL: https://github.com/apache/druid/pull/13380#discussion_r1024826167


##########
extensions-core/kafka-indexing-service/src/main/java/org/apache/druid/indexing/kafka/supervisor/KafkaSupervisor.java:
##########
@@ -293,6 +293,30 @@ protected Map<Integer, Long> 
getRecordLagPerPartition(Map<Integer, Long> current
         );
   }
 
+  @Override
+  // suppress use of CollectionUtils.mapValues() since the valueMapper 
function is dependent on map key here
+  @SuppressWarnings("SSBasedInspection")
+  // Used while generating Supervisor lag reports per task
+  protected Map<Integer, Long> getRecordLagPerPartition(Map<Integer, Long> 
currentOffsets)
+  {
+    if (latestSequenceFromStream == null || currentOffsets == null) {
+      return Collections.emptyMap();
+    }
+
+    return currentOffsets
+        .entrySet()
+        .stream()
+        .filter(e -> latestSequenceFromStream.get(e.getKey()) != null)

Review Comment:
   The old method reports the lag for every partition present in 
`latestSequenceFromStream`.
   But this new one also seems to be doing the same thing because you are 
filtering the entries using the `latestSequenceFromStream`.
   
   I am perhaps missing something but not sure how the two methods are 
different.
   Please also add a test to verify the difference between the two results.



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