Gerrrr commented on code in PR #11945:
URL: https://github.com/apache/kafka/pull/11945#discussion_r850656191


##########
streams/src/main/java/org/apache/kafka/streams/kstream/internals/foreignkeyjoin/SubscriptionWrapperSerde.java:
##########
@@ -141,17 +204,29 @@ public SubscriptionWrapper<K> deserialize(final String 
ignored, final byte[] dat
                 lengthSum += 2 * Long.BYTES;
             }
 
-            final byte[] primaryKeyRaw = new byte[data.length - lengthSum]; 
//The remaining data is the serialized pk
-            buf.get(primaryKeyRaw, 0, primaryKeyRaw.length);
+            final int primaryKeyLength;
+            if (version > 0) {
+                primaryKeyLength = data.length - lengthSum - Integer.BYTES;
+            } else {
+                primaryKeyLength = data.length - lengthSum;
+            }
+            final byte[] primaryKeyRaw = new byte[primaryKeyLength];
+            buf.get(primaryKeyRaw, 0, primaryKeyLength);
 
             if (primaryKeySerializationPseudoTopic == null) {
                 primaryKeySerializationPseudoTopic = 
primaryKeySerializationPseudoTopicSupplier.get();
             }
 
             final K primaryKey = 
primaryKeyDeserializer.deserialize(primaryKeySerializationPseudoTopic,
-                                                                    
primaryKeyRaw);
+                primaryKeyRaw);

Review Comment:
   Fixed in 
https://github.com/apache/kafka/pull/11945/commits/1361497b55b2a34b094582f3220d54bb8e3e6c8a.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to