rajinisivaram commented on code in PR #12914:
URL: https://github.com/apache/kafka/pull/12914#discussion_r1039723313


##########
clients/src/main/java/org/apache/kafka/clients/consumer/internals/AbstractPartitionAssignor.java:
##########
@@ -84,13 +110,65 @@ protected static List<TopicPartition> partitions(String 
topic, int numPartitions
         return partitions;
     }
 
+    protected static Map<String, List<PartitionInfo>> 
partitionInfosWithoutRacks(Map<String, Integer> partitionsPerTopic) {
+        return 
partitionsPerTopic.entrySet().stream().collect(Collectors.toMap(Entry::getKey, 
e -> {
+            String topic = e.getKey();
+            int numPartitions = e.getValue();
+            List<PartitionInfo> partitionInfos = new 
ArrayList<>(numPartitions);
+            for (int i = 0; i < numPartitions; i++)
+                partitionInfos.add(new PartitionInfo(topic, i, Node.noNode(), 
NO_NODES, NO_NODES));
+            return partitionInfos;
+        }));
+    }
+
+    protected static Map<String, List<TopicPartition>> 
partitionsByRack(List<PartitionInfo> partitionInfos, Map<TopicPartition, 
Set<String>> partitionRacks) {

Review Comment:
   Yes, wanted to use a single method for performance reasons with the sticky 
assignor, but will revisit for the sticky assignor PR.



-- 
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: jira-unsubscr...@kafka.apache.org

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

Reply via email to