Andrey Zagrebin created FLINK-10374:
---------------------------------------

             Summary: [Map State] Let user value serializer handle null values
                 Key: FLINK-10374
                 URL: https://issues.apache.org/jira/browse/FLINK-10374
             Project: Flink
          Issue Type: Improvement
          Components: State Backends, Checkpointing
            Reporter: Andrey Zagrebin
             Fix For: 2.0.0


Prior to Flink 2.0, value serializer in map state does not rely on user 
serializer to handle null value. Map serializer always prepends the serialized 
value with one byte boolean flag which signals whether it is null or not.

Map state state supports storing null user values for the following 
get/contains semantics:

remove(k); contains(k) -> false; put(k, null); get(k) -> null; contains(k) -> 
true;

It means that if user does not need this semantics and storing null values or 
the user value serializer already supports null values, one byte will be always 
wasted in the serialized value.

Rather than to hardcode null handling in map state serializer, it can be 
optional and up to the user decide the behaviour. If users want to add null 
support for their serializer, they could wrap it e.g. with NullableSerializer 
which can do the same prepending with null flag.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to