Github user StephanEwen commented on a diff in the pull request:

    https://github.com/apache/flink/pull/5995#discussion_r188355756
  
    --- Diff: 
flink-formats/flink-avro/src/main/java/org/apache/flink/formats/avro/typeutils/AvroSerializer.java
 ---
    @@ -275,9 +304,19 @@ else if (configSnapshot instanceof 
AvroSerializerConfigSnapshot) {
        //  Utilities
        // 
------------------------------------------------------------------------
     
    +   private static boolean isGenericRecord(Class<?> type) {
    +           return !SpecificRecord.class.isAssignableFrom(type) &&
    +                   GenericRecord.class.isAssignableFrom(type);
    +   }
    +
        @Override
        public TypeSerializer<T> duplicate() {
    -           return new AvroSerializer<>(type);
    +           if (schemaString != null) {
    +                   return new AvroSerializer<>(type, new 
Schema.Parser().parse(schemaString));
    --- End diff --
    
    Duplication happens frequently, would be good to avoid schema parsing. You 
can add a private copy constructor that takes class and string.


---

Reply via email to