Stephan Ewen created FLINK-9035:
-----------------------------------
Summary: State Descriptors have broken hashCode() and equals()
Key: FLINK-9035
URL:
https://issues.apache.org/jira/browse/FLINK-9035 Project: Flink
Issue Type: Bug
Components: State Backends, Checkpointing
Affects Versions: 1.4.2, 1.5.0
Reporter: Stephan Ewen
Assignee: Stephan Ewen
Fix For: 1.6.0
The following code fails with a {{NullPointerException}}:
{code}
ValueStateDescriptor<String> descr = new ValueStateDescriptor<>("name", String.class);
descr.hashCode();
{code}
The {{hashCode()}} function tries to access the {{serializer}} field, which may be uninitialized at that point.
The {{equals()}} method is equally broken (no pun intended):
{code}
ValueStateDescriptor<String> a = new ValueStateDescriptor<>("name", String.class);
ValueStateDescriptor<String> b = new ValueStateDescriptor<>("name", String.class);
a.equals(b) // exception
b.equals(a) // exception
a.initializeSerializerUnlessSet(new ExecutionConfig());
a.equals(b) // false
b.equals(a) // exception
b.initializeSerializerUnlessSet(new ExecutionConfig());
a.equals(b) // true
b.equals(a) // true
{code}
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)