ijuma commented on code in PR #19167: URL: https://github.com/apache/kafka/pull/19167#discussion_r2009192580
########## clients/src/main/java/org/apache/kafka/common/requests/FetchResponse.java: ########## @@ -286,4 +291,12 @@ private static FetchResponseData toMessage(Errors error, .setSessionId(sessionId) .setResponses(topicResponseList); } + + private static FetchResponseData convertNullRecordsToEmpty(FetchResponseData fetchResponseData) { + fetchResponseData.responses().stream() + .flatMap(response -> response.partitions().stream()) + .filter(partition -> partition.records() == null) + .forEach(partition -> partition.setRecords(MemoryRecords.EMPTY)); Review Comment: The fetch path is perf sensitive and we are adding runtime cost every time even though this should never be required (i.e. the calling code should be doing the right thing already). Would a nested foreach loop be more efficient here? -- 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