sebastienviale commented on code in PR #22612:
URL: https://github.com/apache/kafka/pull/22612#discussion_r3444205108


##########
streams/test-utils/src/main/java/org/apache/kafka/streams/test/TestRecord.java:
##########
@@ -151,6 +177,7 @@ public TestRecord(final ProducerRecord<K, V> record) {
         this.value = record.value();
         this.headers = record.headers();
         this.recordTime = Instant.ofEpochMilli(record.timestamp());
+        this.partition = record.partition() != null ? record.partition() : 
NO_PARTITION;

Review Comment:
   I just realized that ProducerRecord already has a sentinel and does not 
allow arbitrary negative values. Therefore, mapping null to NO_PARTITION and 
preserving non-negative partitions should be sufficient:
   So can we just add:         
   `this.partition = record.partition() != null && record.partition() >= 0 ?  
record.partition() : NO_PARTITION;`
   



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