PatrickRen commented on a change in pull request #17991:
URL: https://github.com/apache/flink/pull/17991#discussion_r762852449
##########
File path:
flink-connectors/flink-connector-kafka/src/test/java/org/apache/flink/connector/kafka/source/KafkaSourceITCase.java
##########
@@ -299,10 +319,17 @@ public void deserialize(
if (deserializer == null) {
deserializer = new IntegerDeserializer();
}
- collector.collect(
- new PartitionAndValue(
- new TopicPartition(record.topic(),
record.partition()),
- deserializer.deserialize(record.topic(),
record.value())));
+
+ if (enableObjectReuse) {
+ reuse.tp = new TopicPartition(record.topic(),
record.partition()).toString();
+ reuse.value = deserializer.deserialize(record.topic(),
record.value());
+ collector.collect(reuse);
+ } else {
+ collector.collect(
+ new PartitionAndValue(
+ new TopicPartition(record.topic(),
record.partition()),
+ deserializer.deserialize(record.topic(),
record.value())));
+ }
}
Review comment:
Thanks for the review! Basically the bug is caused by using
object-reusing deserialization schema in KafkaSource. Some explanation can be
found in [FLINK-25132](https://issues.apache.org/jira/browse/FLINK-25132).
I improved this test case for validating that KafkaSource indeed works well
if deserialization schema reuses object.
--
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]