openinx commented on a change in pull request #12428:
URL: https://github.com/apache/flink/pull/12428#discussion_r433880444
##########
File path:
flink-formats/flink-avro/src/main/java/org/apache/flink/formats/avro/AvroRowDeserializationSchema.java
##########
@@ -157,13 +150,13 @@ public AvroRowDeserializationSchema(String
avroSchemaString) {
record = new GenericData.Record(schema);
datumReader = new GenericDatumReader<>(schema);
inputStream = new MutableByteArrayInputStream();
- decoder = DecoderFactory.get().binaryDecoder(inputStream, null);
}
@Override
public Row deserialize(byte[] message) throws IOException {
try {
inputStream.setBuffer(message);
+ Decoder decoder =
DecoderFactory.get().binaryDecoder(inputStream, null);
Review comment:
@libenchao I've added the similar fix for
`AvroRowDataDeserializationSchema `. Also reconsidered the overhead of
`DecoderFactory.get().binaryDecoder(inputStream, null)`, it would allocate 8KB
buffer for each creation if don't reuse, So I changed to reuse the decode to
fix this. Thanks.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]