skaundinya15 commented on a change in pull request #10962:
URL: https://github.com/apache/kafka/pull/10962#discussion_r663419495



##########
File path: 
clients/src/main/java/org/apache/kafka/common/requests/OffsetFetchResponse.java
##########
@@ -154,14 +166,88 @@ public OffsetFetchResponse(int throttleTimeMs, Errors 
error, Map<TopicPartition,
         this.error = error;
     }
 
+    /**
+     * Constructor without throttle time for version 8 and above.
+     * @param errors Error code on a per group level basis
+     * @param responseData Fetched offset information grouped group id
+     */
+    public OffsetFetchResponse(Map<String, Errors> errors, Map<String, 
Map<TopicPartition, PartitionData>> responseData) {
+        this(DEFAULT_THROTTLE_TIME, errors, responseData);
+    }
+
+    /**
+     * Constructor with throttle time for version 8 and above.
+     * @param throttleTimeMs The time in milliseconds that this response was 
throttled
+     * @param errors Potential coordinator or group level error code (for api 
version 2 and later)
+     * @param responseData Fetched offset information grouped by 
topic-partition and by group
+     */
+    public OffsetFetchResponse(int throttleTimeMs, Map<String, Errors> errors, 
Map<String,
+        Map<TopicPartition, PartitionData>> responseData) {
+        super(ApiKeys.OFFSET_FETCH);
+        List<OffsetFetchResponseGroup> groupList = new ArrayList<>();
+        for (Entry<String, Map<TopicPartition, PartitionData>> entry : 
responseData.entrySet()) {
+            Map<String, OffsetFetchResponseTopics> 
offsetFetchResponseTopicsMap = new HashMap<>();
+            for (Entry<TopicPartition, PartitionData> partitionEntry :
+                responseData.get(entry.getKey()).entrySet()) {

Review comment:
       I think we still want `entry.getKey()` as that returns the `String` 
group Id. `entry.getValue()` returns `Map<TopicPartition, PartitionData>`. I 
will change it so that we save `entry.getKey()` in a local variable so we don't 
have to keep calling 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: jira-unsubscr...@kafka.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to