Uploaded image for project: 'Flink'
  1. Flink
  2. FLINK-10374

[Map State] Let user value serializer handle null values

    XMLWordPrintableJSON

Details

    Description

      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.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              azagrebin Andrey Zagrebin
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated: