rreddy-22 commented on code in PR #14481: URL: https://github.com/apache/kafka/pull/14481#discussion_r1401419710
########## group-coordinator/src/main/java/org/apache/kafka/coordinator/group/assignor/AbstractUniformAssignmentBuilder.java: ########## @@ -223,22 +223,13 @@ protected boolean racksMismatch(String memberId, TopicIdPartition tp) { * @return A sorted list of partitions with potential members in the same rack. */ protected List<TopicIdPartition> sortPartitionsByRackMembers(Collection<TopicIdPartition> topicIdPartitions) { - - List<TopicIdPartition> sortedPartitionsList = topicIdPartitions.stream() - .sorted(Comparator.comparing(TopicIdPartition::topicId).thenComparing(TopicIdPartition::partitionId)) + return topicIdPartitions.stream() + .filter(tp -> membersWithSameRackAsPartition.containsKey(tp) && !membersWithSameRackAsPartition.get(tp).isEmpty()) + .sorted(Comparator.comparing( + (TopicIdPartition tp) -> membersWithSameRackAsPartition.getOrDefault(tp, Collections.emptyList()).size()) Review Comment: If I omit the type then I get an error cause the topicId method can't be inferred correctly by the compiler, I need to explicitly mention the type. Do you have a workaround for this? -- 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