loicgreffier commented on code in PR #18739: URL: https://github.com/apache/kafka/pull/18739#discussion_r1937172436
########## streams/src/main/java/org/apache/kafka/streams/processor/internals/ProcessorRecordContext.java: ########## @@ -48,6 +50,24 @@ public ProcessorRecordContext(final long timestamp, this.topic = topic; this.partition = partition; this.headers = Objects.requireNonNull(headers); + this.sourceRawKey = null; + this.sourceRawValue = null; Review Comment: Indeed having "optional" raw key and value make the deserialization tricky. Let's say we serialize the `ProcessorRecordContext` in this order `timestamp, offset, topic, partition, headers, rawKey, rawValue`. After deserializing the headers, the next bytes can be `rawKey` and `rawValue` or can be something else (e.g., `priorValue` https://github.com/apache/kafka/blob/d7a5b877f299ac20564dbb605e1a9c60fa835132/streams/src/main/java/org/apache/kafka/streams/state/internals/BufferValue.java#L73) Right now I'm considering serializing the `rawKey` and `rawValue` at the very end of the `ByteBuffer` (i.e., right after here: https://github.com/apache/kafka/blob/d7a5b877f299ac20564dbb605e1a9c60fa835132/streams/src/main/java/org/apache/kafka/streams/state/internals/BufferValue.java#L119). Thus, after deserializing all the non-optional fields if there is some bytes remaining in the buffer, it should be the `rawKey` and `rawValue`. -- 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