Martijn Visser created FLINK-41493:
--------------------------------------
Summary: PTF state restore silently swaps values when POJO fields
of the same type change position
Key: FLINK-41493
URL: https://issues.apache.org/jira/browse/FLINK-41493
Project: Flink
Issue Type: Bug
Components: Table SQL / Runtime
Reporter: Martijn Visser
A PTF with a POJO state entry restores wrong values when the attribute order of
the POJO changes. Without an assigning constructor, attributes are sorted by
name. So renaming {{count}} to {{visits}} in a POJO with {{long count, long
total}} changes the layout from {{[count, total]}} to {{[total, visits]}}.
Reordering the parameters of an assigning constructor has the same effect. In
both cases {{RowDataSerializerSnapshot#resolveSchemaCompatibility}} only
compares field types and returns compatible, and the values swap: the restored
job reports {{count=18, total=3}} instead of {{count=3, total=18}}. Heap and
RocksDB behave the same, with or without a compiled plan.
Since FLINK-40120 the snapshot contains the field names. We should return
incompatible when a name in both snapshots changed position, also when the
migration from FLINK-40298 is disabled.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)