kamalcph commented on code in PR #14285:
URL: https://github.com/apache/kafka/pull/14285#discussion_r1305533735


##########
storage/src/test/java/org/apache/kafka/tiered/storage/utils/RecordsKeyValueMatcher.java:
##########
@@ -138,18 +140,21 @@ private boolean compare(ByteBuffer lhs,
     private SimpleRecord convert(Object recordCandidate) {
         if (recordCandidate instanceof ProducerRecord) {
             ProducerRecord<?, ?> record = (ProducerRecord<?, ?>) 
recordCandidate;
+            long timestamp = record.timestamp() == null ? 
RecordBatch.NO_TIMESTAMP : record.timestamp();
             ByteBuffer keyBytes =
                     
Utils.wrapNullable(keySerde.serializer().serialize(topicPartition.topic(), (K) 
record.key()));
             ByteBuffer valueBytes =
                     
Utils.wrapNullable(valueSerde.serializer().serialize(topicPartition.topic(), 
(V) record.value()));
-            return new SimpleRecord(record.timestamp(), keyBytes, valueBytes, 
record.headers().toArray());
+            Header[] headers = record.headers() != null ? 
record.headers().toArray() : Record.EMPTY_HEADERS;
+            return new SimpleRecord(timestamp, keyBytes, valueBytes, headers);
         } else if (recordCandidate instanceof ConsumerRecord) {
             ConsumerRecord<?, ?> record = (ConsumerRecord<?, ?>) 
recordCandidate;
             ByteBuffer keyBytes =
                     
Utils.wrapNullable(keySerde.serializer().serialize(topicPartition.topic(), (K) 
record.key()));
             ByteBuffer valueBytes =
                     
Utils.wrapNullable(valueSerde.serializer().serialize(topicPartition.topic(), 
(V) record.value()));
-            return new SimpleRecord(record.timestamp(), keyBytes, valueBytes, 
record.headers().toArray());
+            Header[] headers = record.headers() != null ? 
record.headers().toArray() : Record.EMPTY_HEADERS;
+            return new SimpleRecord(record.timestamp(), keyBytes, valueBytes, 
headers);

Review Comment:
   ProducerRecord returns object Long whereas the other records return 
primitive long.



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

Reply via email to