philipnee commented on code in PR #12545:
URL: https://github.com/apache/kafka/pull/12545#discussion_r1006249694
##########
clients/src/main/java/org/apache/kafka/clients/consumer/internals/Fetcher.java:
##########
@@ -1413,22 +1414,19 @@ private ConsumerRecord<K, V> parseRecord(TopicPartition
partition,
RecordBatch batch,
Record record) {
try {
- long offset = record.offset();
- long timestamp = record.timestamp();
- Optional<Integer> leaderEpoch =
maybeLeaderEpoch(batch.partitionLeaderEpoch());
- TimestampType timestampType = batch.timestampType();
- Headers headers = new RecordHeaders(record.headers());
- ByteBuffer keyBytes = record.key();
- byte[] keyByteArray = keyBytes == null ? null :
Utils.toArray(keyBytes);
- K key = keyBytes == null ? null :
this.keyDeserializer.deserialize(partition.topic(), headers, keyByteArray);
- ByteBuffer valueBytes = record.value();
- byte[] valueByteArray = valueBytes == null ? null :
Utils.toArray(valueBytes);
- V value = valueBytes == null ? null :
this.valueDeserializer.deserialize(partition.topic(), headers, valueByteArray);
+ final long offset = record.offset();
+ final long timestamp = record.timestamp();
+ final Optional<Integer> leaderEpoch =
maybeLeaderEpoch(batch.partitionLeaderEpoch());
+ final TimestampType timestampType = batch.timestampType();
+ final Headers headers = new RecordHeaders(record.headers());
+ final ByteBuffer keyBytes = record.key();
+ final int keySize = keyBytes == null ? NULL_SIZE :
keyBytes.remaining();
+ final K key = keyBytes == null ? null :
this.keyDeserializer.deserialize(partition.topic(), headers, keyBytes);
+ final ByteBuffer valueBytes = record.value();
+ final int valueSize = valueBytes == null ? NULL_SIZE :
valueBytes.remaining();
+ final V value = valueBytes == null ? null :
this.valueDeserializer.deserialize(partition.topic(), headers, valueBytes);
return new ConsumerRecord<>(partition.topic(),
partition.partition(), offset,
- timestamp, timestampType,
- keyByteArray == null ?
ConsumerRecord.NULL_SIZE : keyByteArray.length,
- valueByteArray == null ?
ConsumerRecord.NULL_SIZE : valueByteArray.length,
- key, value, headers, leaderEpoch);
+ timestamp, timestampType, keySize, valueSize, key, value,
headers, leaderEpoch);
Review Comment:
consider breaking the return params into multiple lines?
--
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]