jolshan commented on a change in pull request #9626: URL: https://github.com/apache/kafka/pull/9626#discussion_r540510301
########## File path: clients/src/main/java/org/apache/kafka/common/requests/LeaderAndIsrResponse.java ########## @@ -45,8 +47,16 @@ public LeaderAndIsrResponse(Struct struct, short version) { this.data = new LeaderAndIsrResponseData(struct, version); } - public List<LeaderAndIsrPartitionError> partitions() { - return data.partitionErrors(); + public List<LeaderAndIsrTopicError> topics() { + return this.data.topics(); + } + + public Iterable<LeaderAndIsrPartitionError> partitions() { + if (data.topics().isEmpty()) { + return data.partitionErrors(); + } + return () -> new FlattenedIterator<>(data.topics().iterator(), + topic -> topic.partitionErrors().iterator()); Review comment: I'm thinking that it most cases where I create a LeaderAndIsrResponse with the data object, I have access to the request and can grab the version there. Then I can add it to the constructor. ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org