libenchao commented on a change in pull request #12428:
URL: https://github.com/apache/flink/pull/12428#discussion_r433593166



##########
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:
       AvroRowDataDeserializationSchema should also be considered.

##########
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:
       Do you known the overhead of 
`DecoderFactory.get().binaryDecoder(inputStream, null);`?  
   If it's heavy, maybe we can get a new decoder when encounters a schema 
change exception?




----------------------------------------------------------------
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:
us...@infra.apache.org


Reply via email to