[ 
https://issues.apache.org/jira/browse/FLINK-5023?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15648122#comment-15648122
 ] 

Aljoscha Krettek commented on FLINK-5023:
-----------------------------------------

[~StephanEwen] [~xiaogang.shi] In fact, I would prefer if we went one step 
further and have {{ReadableState}} like this:

{code}
interface ReadableState<T> {
  T get();
}
{code}

{{ValueState}} would then be
{code}
public interface ValueState<T> extends State, ReadableState<T>, 
OperatorState<T> { // OperatorState is here for backwards compatibility
...
}
{code}

I want a clear separation of capabilities of state accessors because I think 
that this might become relevant in the future. I even have a concrete use case 
right now: for FLINK-4940/FLINK-3659 I want to reuse the state interfaces 
because then users can use the same known state types for interacting with 
broadcast/global state that they use for accessing keyed state. In that case, 
users should be allowed read/write access when processing data from the 
broadcast side while they should only have read access when processing data 
from non-broadcast inputs (otherwise, the assumption that broadcast state is 
the same on all parallel subtask instances of an operator can be violated.).

For this, users would only be allowed to get a {{ReadableState}} for read 
access and a full {{ValueState}} (or {{ListState}} or {{ReducingState}}...) for 
read/write access.

> 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)

Reply via email to