TaiJuWu commented on code in PR #20064:
URL: https://github.com/apache/kafka/pull/20064#discussion_r2203817615
##########
tools/src/main/java/org/apache/kafka/tools/consumer/group/ConsumerGroupCommand.java:
##########
@@ -631,7 +634,34 @@ else if (logEndOffsetResult.getValue() instanceof
OffsetsUtils.Ignore)
return null;
throw new IllegalStateException("Unknown LogOffset subclass: "
+ logEndOffsetResult.getValue());
- }).collect(Collectors.toList());
+ }).toList();
+
+ // prepare data for partitions without leaders
+ List<PartitionAssignmentState> noneLeaderAssignments =
topicPartitionsWithoutLeader.stream()
+ .map(tp -> getDescribePartitionResult.apply(tp,
Optional.empty())).toList();
+
+ // concat the data and then sort them
+ return Stream.concat(existLeaderAssignments.stream(),
noneLeaderAssignments.stream())
+ .sorted(Comparator.<PartitionAssignmentState,
String>comparing(
+ state -> state.topic.orElse(""), String::compareTo)
Review Comment:
Just out of curiosity, topic is allowed to be `Optional.empty` or empty
string ?
##########
tools/src/main/java/org/apache/kafka/tools/consumer/group/ConsumerGroupCommand.java:
##########
@@ -592,8 +592,7 @@ private Collection<PartitionAssignmentState>
collectConsumerAssignment(
getLag(Optional.empty(), Optional.empty()),
consumerIdOpt, hostOpt, clientIdOpt, Optional.empty(), Optional.empty())
Review Comment:
`LOGGER` is not used at Line 85 in this file, should we remove it?
--
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]