You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2018/05/11 15:17:00 UTC

[jira] [Commented] (FLINK-9036) Add default value via suppliers

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

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

Github user StephanEwen commented on the issue:

    https://github.com/apache/flink/pull/5735
  
    @aljoscha Would be interested in your opinion here.
    
    This is basically one of two ways to improve the handling of default values:
      1. Add a default value supplier on the state descriptor (this approach). Advantage is that you can use this to backwards compatibly handle the previous cases of default values (including the starting value for folding state)
      2. Add a `T getOrDefault(Supplier<T>)` method to `ValueState`. This might me almost simpler to do even, and more flexible as it allows for different default values in different contexts. This can get inefficient though when users naively create an anonymous class for the supplier (probably not a big deal any more since lambdas) and it breaks with the current approach, meaning we two different ways for default values that need to work together, one of which is deprecated, but still needs to be supported until Flink 2.0


> Add default value via suppliers
> -------------------------------
>
>                 Key: FLINK-9036
>                 URL: https://issues.apache.org/jira/browse/FLINK-9036
>             Project: Flink
>          Issue Type: Improvement
>          Components: State Backends, Checkpointing
>            Reporter: Stephan Ewen
>            Assignee: Stephan Ewen
>            Priority: Major
>             Fix For: 1.6.0
>
>
> Earlier versions had a default value in {{ValueState}}. We dropped that, because the value would have to be duplicated on each access, to be safe against side effects when using mutable types.
> For convenience, we should re-add the feature, but using a supplier/factory function to create the default value on access.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)