[
https://issues.apache.org/jira/browse/FLINK-5023?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15647572#comment-15647572
]
ASF GitHub Bot commented on FLINK-5023:
---------------------------------------
Github user StephanEwen commented on a diff in the pull request:
https://github.com/apache/flink/pull/2768#discussion_r86987978
--- Diff:
flink-core/src/main/java/org/apache/flink/api/common/state/ListStateDescriptor.java
---
@@ -84,21 +138,37 @@ public boolean equals(Object o) {
ListStateDescriptor<?> that = (ListStateDescriptor<?>) o;
- return serializer.equals(that.serializer) &&
name.equals(that.name);
-
+ return elemTypeSerializer.equals(that.elemTypeSerializer) &&
name.equals(that.name);
}
@Override
public int hashCode() {
- int result = serializer.hashCode();
+ int result = elemTypeSerializer.hashCode();
result = 31 * result + name.hashCode();
return result;
}
@Override
public String toString() {
return "ListStateDescriptor{" +
- "serializer=" + serializer +
+ "elem serializer=" + elemTypeSerializer +
'}';
}
+
+ //
------------------------------------------------------------------------
+ // Serialization
+ //
------------------------------------------------------------------------
+
+ private void writeObject(final ObjectOutputStream out) throws
IOException {
+ // make sure we have a serializer before the type information
gets lost
+ initializeSerializerUnlessSet(new ExecutionConfig());
+
+ // write all the non-transient fields
+ out.defaultWriteObject();
+ }
+
+ private void readObject(final ObjectInputStream in) throws IOException,
ClassNotFoundException {
--- End diff --
I think this method is not necessary, because it only triggers default
serialization anyways.
> Add get() method in State interface
> -----------------------------------
>
> Key: FLINK-5023
> URL: https://issues.apache.org/jira/browse/FLINK-5023
> Project: Flink
> Issue Type: Improvement
> Components: State Backends, Checkpointing
> Reporter: Xiaogang Shi
> Assignee: Xiaogang Shi
>
> Currently, the only method provided by the State interface is `clear()`. I
> think we should provide another method called `get()` to return the
> structured value (e.g., value, list, or map) under the current key.
> In fact, the functionality of `get()` has already been implemented in all
> types of states: e.g., `value()` in ValueState and `get()` in ListState. The
> modification to the interface can better abstract these states.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)