m1a2st commented on code in PR #19578:
URL: https://github.com/apache/kafka/pull/19578#discussion_r2062839985


##########
clients/src/main/java/org/apache/kafka/clients/consumer/internals/events/ListOffsetsEvent.java:
##########
@@ -47,13 +47,10 @@ public ListOffsetsEvent(Map<TopicPartition, Long> 
timestampToSearch,
     /**
      * Build result representing that no offsets were found as part of the 
current event.
      *
-     * @return Map containing all the partitions the event was trying to get 
offsets for, and
-     * null {@link OffsetAndTimestamp} as value
+     * @return empty map
      */
     public <T> Map<TopicPartition, T> emptyResults() {
-        Map<TopicPartition, T> result = new HashMap<>();
-        timestampsToSearch.keySet().forEach(tp -> result.put(tp, null));
-        return result;
+        return new HashMap<>();

Review Comment:
   ```suggestion
           return Map.of();
   ```



##########
core/src/test/scala/integration/kafka/api/PlaintextConsumerTest.scala:
##########
@@ -873,4 +873,17 @@ class PlaintextConsumerTest extends BaseConsumerTest {
       waitTimeMs=leaveGroupTimeoutMs
     )
   }
+
+  @ParameterizedTest(name = 
TestInfoUtils.TestWithParameterizedGroupProtocolNames)
+  @MethodSource(Array("getTestGroupProtocolParametersAll"))
+  def test(groupProtocol: String): Unit = {
+    val consumer = createConsumer()
+    val result1 = consumer.beginningOffsets(Collections.singleton(tp), 
Duration.ZERO)

Review Comment:
   ```suggestion
       val result1 = consumer.beginningOffsets(List.of(tp), Duration.ZERO)
   ```



##########
core/src/test/scala/integration/kafka/api/PlaintextConsumerTest.scala:
##########
@@ -873,4 +873,17 @@ class PlaintextConsumerTest extends BaseConsumerTest {
       waitTimeMs=leaveGroupTimeoutMs
     )
   }
+
+  @ParameterizedTest(name = 
TestInfoUtils.TestWithParameterizedGroupProtocolNames)
+  @MethodSource(Array("getTestGroupProtocolParametersAll"))
+  def test(groupProtocol: String): Unit = {
+    val consumer = createConsumer()
+    val result1 = consumer.beginningOffsets(Collections.singleton(tp), 
Duration.ZERO)
+    assertNotNull(result1)
+    assertEquals(0, result1.size())
+
+    val result2 = consumer.endOffsets(Collections.singleton(tp), Duration.ZERO)

Review Comment:
   ```suggestion
       val result2 = consumer.endOffsets(List.of(tp), Duration.ZERO)
   ```



-- 
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