[
https://issues.apache.org/jira/browse/FLINK-5023?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15852487#comment-15852487
]
ASF GitHub Bot commented on FLINK-5023:
---------------------------------------
Github user shixiaogang commented on the issue:
https://github.com/apache/flink/pull/2768
@StephanEwen Thanks a lot for your comments.
**Removing `clear()` from `State`**
This change is suggested by @aljoscha who wants to let broadcast states
share the same interface (see the discussion in
[FLINK-5023](https://issues.apache.org/jira/browse/FLINK-5023)) . As mentioned,
the broadcast states are read-only in some cases. Hence it's suggested not to
provide the `clear()` method in the base `State` interface.
**Changing the `State` interface**
The `State` interface is typed because I want to provide the `get()` method
for all states so that we can retrieve the data in the state (under the current
key for keyed states). The functionality is already provided by all states
except `ValueState` who provides the same functionality with the `value()`
method. Providing the method for all states can help reduce some duplicated
code in the implementation. It also makes sense for read-only states mentioned
above.
> 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.15#6346)