You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "Till Rohrmann (JIRA)" <ji...@apache.org> on 2016/03/01 12:36:18 UTC

[jira] [Updated] (FLINK-3557) Scala DataStream fold method should take fold function in secondary parameter list

     [ https://issues.apache.org/jira/browse/FLINK-3557?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Till Rohrmann updated FLINK-3557:
---------------------------------
    Description: 
The current Scala DataStream API offers a {{fold}} method. The {{fold}} method takes two parameters, the initial value and the fold function. However, both parameters are specified in the same parameter list. This makes it clumsy to provide a multi-line anonymous function as the fold function parameter in Scala. One would have to wrap the function in an additional pair of curly braces. This could be avoided by having a second parameter list which takes the fold function. This would, additionally, be consistent with Scala's collection API.

Old style
{code}
windowedStream.fold(("R:", 0), { (acc: (String, Int), v: (String, Int)) => (acc._1 + v._1, acc._2 + v._2) })
{code}

vs. new style
{code}
windowedStream.fold(("R:", 0)){ (acc, v) => (acc._1 + v._1, acc._2 + v._2) }
{code}

These changes are API breaking.

  was:
The current Scala DataStream API offers a {{fold}} method. The {{fold}} method takes two parameters, the initial value and the fold function. However, both parameters are specified in the same parameter list. This makes it clumsy to provide a multi-line anonymous function as the fold function parameter in Scala. One would have to wrap the function in an additional pair of curly braces. This could be avoided by having a second parameter list which takes the fold function. This would, additionally, be consistent with Scala's collection API.

Old style
{code}
windowedStream.fold(("R:", 0), { (acc: (String, Int), v: (String, Int)) => (acc._1 + v._1, acc._2 + v._2) })
{code}

vs. new style
{code}
windowedStream.fold(("R:", 0)){ (acc: (String, Int), v: (String, Int)) => (acc._1 + v._1, acc._2 + v._2) }
{code}

These changes are API breaking.


> Scala DataStream fold method should take fold function in secondary parameter list
> ----------------------------------------------------------------------------------
>
>                 Key: FLINK-3557
>                 URL: https://issues.apache.org/jira/browse/FLINK-3557
>             Project: Flink
>          Issue Type: Improvement
>          Components: DataStream API, Scala API
>    Affects Versions: 1.0.0
>            Reporter: Till Rohrmann
>            Assignee: Till Rohrmann
>            Priority: Minor
>
> The current Scala DataStream API offers a {{fold}} method. The {{fold}} method takes two parameters, the initial value and the fold function. However, both parameters are specified in the same parameter list. This makes it clumsy to provide a multi-line anonymous function as the fold function parameter in Scala. One would have to wrap the function in an additional pair of curly braces. This could be avoided by having a second parameter list which takes the fold function. This would, additionally, be consistent with Scala's collection API.
> Old style
> {code}
> windowedStream.fold(("R:", 0), { (acc: (String, Int), v: (String, Int)) => (acc._1 + v._1, acc._2 + v._2) })
> {code}
> vs. new style
> {code}
> windowedStream.fold(("R:", 0)){ (acc, v) => (acc._1 + v._1, acc._2 + v._2) }
> {code}
> These changes are API breaking.



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