Weiqing Yang created FLINK-40296:
------------------------------------

             Summary: Add an object-level migrate hook to TypeSerializerSnapshot
                 Key: FLINK-40296
                 URL: https://issues.apache.org/jira/browse/FLINK-40296
             Project: Flink
          Issue Type: Sub-task
          Components: API / Type Serialization System
            Reporter: Weiqing Yang


FLIP-527 needs a way for a serializer snapshot to transform an 
already-deserialized state value from the schema it was written with into the 
schema the current serializer expects.

  This adds a single default method to TypeSerializerSnapshot:

  {code:java}
  default T migrate(TypeSerializerSnapshot<T> oldSerializerSnapshot, T value) {
      return value;
  }
  {code}

  Like resolveSchemaCompatibility, it is invoked on the new snapshot and 
receives the old snapshot as its argument. The default returns the value 
unchanged, so behavior is unaffected for
  every existing serializer: a value deserialized with the prior serializer is 
structurally compatible with the current one and can be re-serialized as is.

  Serializers whose in-memory representation is coupled to the schema override 
it. The RowData serializer does so in a follow-up subtask, remapping fields by 
name.

  FLIP-527: 
https://cwiki.apache.org/confluence/spaces/FLINK/pages/353601981/FLIP-527+State+Schema+Evolution+for+RowData



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to