chia7712 commented on code in PR #20064: URL: https://github.com/apache/kafka/pull/20064#discussion_r2190771068
########## tools/src/main/java/org/apache/kafka/tools/consumer/group/ConsumerGroupCommand.java: ########## @@ -592,8 +592,8 @@ private Collection<PartitionAssignmentState> collectConsumerAssignment( getLag(Optional.empty(), Optional.empty()), consumerIdOpt, hostOpt, clientIdOpt, Optional.empty(), Optional.empty()) ); } else { - List<TopicPartition> topicPartitionsSorted = topicPartitions.stream().sorted(Comparator.comparingInt(TopicPartition::partition)).collect(Collectors.toList()); Review Comment: excuse me, why do we need those changes? ########## tools/src/main/java/org/apache/kafka/tools/consumer/group/ConsumerGroupCommand.java: ########## @@ -619,7 +619,11 @@ private Collection<PartitionAssignmentState> describePartitions( consumerIdOpt, hostOpt, clientIdOpt, logEndOffsetOpt, leaderEpoch); }; - return offsetsUtils.getLogEndOffsets(topicPartitions).entrySet().stream().map(logEndOffsetResult -> { + Set<TopicPartition> nonLeaderTopicPartitions = filterNoneLeaderPartitions(topicPartitions); + + // prepare data for partitions with leaders + topicPartitions.removeAll(nonLeaderTopicPartitions); Review Comment: we don't need to modify the input `topicPartitions` if `filterNoneLeaderPartitions` returns the partitions having leaders. -- 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