Tzu-Li (Gordon) Tai created FLINK-6363:
------------------------------------------

             Summary: Document precedence rules of Kryo serializer registrations
                 Key: FLINK-6363
                 URL: https://issues.apache.org/jira/browse/FLINK-6363
             Project: Flink
          Issue Type: Improvement
          Components: Documentation, Type Serialization System
            Reporter: Tzu-Li (Gordon) Tai
            Assignee: Tzu-Li (Gordon) Tai


Currently, there is no documentation / Javadoc mentioning the precedence rules 
of Kryo registrations via the register methods in 
{{StreamExecutionEnvironment}} / {{ExecutionEnvironment}}.

It is important for the user to be notified of the precedence because the 
{{KryoSerializer}} applies the configurations in a specific order that is not 
visible from the public API.

For example:
{code}
env.addDefaultKryoSerializer(SomeClass.class, SerializerA.class);
env.addDefaultKryoSerializer(SomeClass.class, new SerializerB());
{code}

from this API usage, it may seem as if {{SerializerA}} will be used as the 
default serializer for {{SomeClass}} (or the other way around, depends really 
on how the user perceives this).

However, whatever the called order in this example, {{SerializerB}} will always 
be used because in the case of defining default serializers, due to the 
ordering that the internal {{KryoSerializer}} applies these configurations, 
defining serializer instance has a higher precedence than defining with 
serializer class.

These methods are also subject to the same issue:
{code}
env.registerType(SomeClass.class, SerializerA.class);
env.registerTypeWithKryoSerializer(SomeClass.class, SerializerA.class);
env.registerTypeWithKryoSerializer(SomeClass.class, new SerializerB());
{code}



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to