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

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

Github user tillrohrmann commented on the pull request:

    https://github.com/apache/flink/pull/936#issuecomment-125175011
  
    I don't know of a better solution than the current approach if we want to 
support the `stateByKey` parameter. I agree with Aljoscha that 
`ds.mapWithState({ (x, o) => (x, o) }, true)` does not look really nice and you 
will always have it if you have a multi line UDF.
    
    I was wondering whether we can get rid of the `stateByKey` parameter. Is 
there any use case in which you have a `KeyedDataStream` and set `stateByKey` 
to false? Otherwise we could override the `*WithState` methods in 
`KeyedDataStream` and per default the `StatefulFunction` sets the `partitioned` 
field to `false`?
    
    Other than that, the PR looks really good and I like it a lot :-) 


> Add stateful transformations using lambdas to the Streaming Scala API
> ---------------------------------------------------------------------
>
>                 Key: FLINK-2405
>                 URL: https://issues.apache.org/jira/browse/FLINK-2405
>             Project: Flink
>          Issue Type: New Feature
>          Components: Scala API, Streaming
>            Reporter: Gyula Fora
>            Assignee: Gyula Fora
>            Priority: Minor
>
> I propose to extend the Streaming Scala API methods (map, flatmap, filter 
> etc) with versions that take stateful functions as lambdas. This would allow 
> for a nice functional way of defining stateful transformations:
> Example:
> def mapWithState( fun: (I, Option[S]) => (O, Option[S]), stateByKey: Boolean 
> = false)
> The stateByKey optional flag allows the user to partition the state by key 
> when applied on a KeyedDataStream.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to