You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "mjsax (via GitHub)" <gi...@apache.org> on 2026/03/06 21:12:44 UTC

Re: [PR] KAFKA-20173: Propagate headers into serde 2/N [kafka]

mjsax commented on code in PR #21536:
URL: https://github.com/apache/kafka/pull/21536#discussion_r2897858664


##########
streams/src/test/java/org/apache/kafka/streams/kstream/SessionWindowedDeserializerTest.java:
##########
@@ -118,14 +118,13 @@ public void shouldThrowConfigExceptionWhenInvalidWindowedInnerDeserializerClassS
     }
 
     @Test
-    public void shouldPassHeadersToUnderlyingSerializer() {
+    public void shouldPassHeadersToUnderlyingDeserializer() {
         final Deserializer<String> mockDeserializer = mock(StringDeserializer.class);
         when(mockDeserializer.deserialize(anyString(), any(Headers.class), any(byte[].class))).thenReturn("test-value");
 
-        final String key = "test-key";
-        final Windowed<String> windowed = new Windowed<>(key, new TimeWindow(0, 1));

Review Comment:
   Oh dear... Using `TimeWindow`... 🤦 



##########
streams/src/main/java/org/apache/kafka/streams/state/internals/MergedSortedCacheWindowStoreKeyValueIterator.java:
##########
@@ -76,7 +78,7 @@ KeyValue<Windowed<Bytes>, byte[]> deserializeStorePair(final KeyValue<Windowed<B
     @Override
     Windowed<Bytes> deserializeCacheKey(final Bytes cacheKey) {
         final byte[] binaryKey = cacheFunction.key(cacheKey).get();
-        return storeKeyToWindowKey.toWindowKey(binaryKey, windowSize, serdes.keyDeserializer(), serdes.topic());
+        return storeKeyToWindowKey.toWindowKey(binaryKey, windowSize, serdes.keyDeserializer(), new RecordHeaders(), serdes.topic());

Review Comment:
   This is a good question -- not sure; would it be difficult to pass in header from the cache-entry into this method?
   
   I more about cleanliness and begin future prove if case anything changes.



##########
streams/src/test/java/org/apache/kafka/streams/kstream/SessionWindowedSerializerTest.java:
##########
@@ -123,7 +123,7 @@ public void shouldPassHeadersToUnderlyingSerializer() {
         when(mockSerializer.serialize(anyString(), any(Headers.class), anyString())).thenReturn("test-value".getBytes());
 
         final String key = "test-key";
-        final Windowed<String> data = new Windowed<>(key, new TimeWindow(0, 1));
+        final Windowed<String> data = new Windowed<>(key, new SessionWindow(0, 1));

Review Comment:
   Great catch.



-- 
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-unsubscribe@kafka.apache.org

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