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


##########
streams/test-utils/src/main/java/org/apache/kafka/streams/test/TestRecord.java:
##########
@@ -138,10 +163,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() < 0 ?  NO_PARTITION : 
record.partition();

Review Comment:
   Both should throw IMO — silent normalization makes it hard to catch bugs 
where a negative partition sneaks in from a misbehaving ConsumerRecord. The  
sentinel () is only used internally before a record is assigned, so it 
shouldn't appear in records that reach test code.



##########
streams/test-utils/src/main/java/org/apache/kafka/streams/test/TestRecord.java:
##########
@@ -138,10 +163,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() < 0 ?  NO_PARTITION : 
record.partition();

Review Comment:
   Both should throw IMO — silent normalization makes it hard to catch bugs 
where a negative partition sneaks in from a misbehaving ConsumerRecord. The 
NO_PARTITION sentinel (-1) is only used internally before a record is assigned, 
so it shouldn't appear in records that reach test code.



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