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


##########
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:
   For ProducerRecord, I think it is a little bit different than ConsumerRecord 
because a ProducerRecord without a partition is certainly a bug from the 
caller. 
   In this case we can throw an exception. 



##########
streams/test-utils/src/main/java/org/apache/kafka/streams/test/TestRecord.java:
##########
@@ -138,10 +162,12 @@ public TestRecord(final ConsumerRecord<K, V> record) {
         this.value = record.value();
         this.headers = record.headers();
         this.recordTime = Instant.ofEpochMilli(record.timestamp());
+        this.partition = record.partition();

Review Comment:
   If we choose to throw an exception, I think we could break some exiting 
tests.
   So silent normalization is acceptable, we can overwrite to `-1` if the 
Partition is `< 0`
   



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