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

ASF GitHub Bot commented on FLINK-7475:
---------------------------------------

Github user StefanRRichter commented on a diff in the pull request:

    https://github.com/apache/flink/pull/4963#discussion_r159631427
  
    --- Diff: 
flink-core/src/main/java/org/apache/flink/api/common/state/ListState.java ---
    @@ -33,4 +35,14 @@
      * @param <T> Type of values that this list state keeps.
      */
     @PublicEvolving
    -public interface ListState<T> extends MergingState<T, Iterable<T>> {}
    +public interface ListState<T> extends MergingState<T, Iterable<T>> {
    +   /**
    +    * Updates the state of the current key for the given source namespaces 
into the state of
    +    * the target namespace.
    +    *
    +    * @param values The target namespace where the merged state should be 
stored.
    +    *
    +    * @throws Exception The method may forward exception thrown internally 
(by I/O or functions).
    +    */
    +   void update(List<T> values) throws Exception;
    --- End diff --
    
    Ok, if the outcome for both cases should be the same, wouldn't it be nicer 
to always return the empty iterator and avoid `null`s if we can? This might be 
a small thing but safe users from debugging some NPEs :-)


> support update() in ListState
> -----------------------------
>
>                 Key: FLINK-7475
>                 URL: https://issues.apache.org/jira/browse/FLINK-7475
>             Project: Flink
>          Issue Type: Improvement
>          Components: Core, DataStream API, State Backends, Checkpointing
>    Affects Versions: 1.4.0
>            Reporter: yf
>            Assignee: Bowen Li
>             Fix For: 1.5.0
>
>
> If I want to update the list. 
> I have to do two steps: 
> listState.clear() 
> for (Element e : myList) { 
>     listState.add(e); 
> } 
> Why not I update the state by: 
> listState.update(myList) ?



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to