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

Gyula Fora commented on FLINK-1450:
-----------------------------------

Hey Amit,
Thanks for the interest. 
Basically there are three parts you need to write:
Create a FoldFunction and RichFoldFunction as the interfaces for the udfs (take 
a look at the reduce function and rich reduce function for reference)

Next you need to create a StreamInvokable (better ChainableInvokable) that will 
apply the UDF to the stream. Take a look at the MapInvokable or 
StreamReduceInvokable.

Last step is to integrate it to the DataStream (the api) for both java and 
Scala. You will use the transform method of the java data stream as all the 
other operators. The method signature for the Scala api should exactly be like 
the fold operator on collections. The java should be similar using the 
foldfunction interface.

Let me know if you have further questions. I might be slow to answer because I 
am on vacation.

Cheers,
Gyula

> Add Fold operator to the Streaming api
> --------------------------------------
>
>                 Key: FLINK-1450
>                 URL: https://issues.apache.org/jira/browse/FLINK-1450
>             Project: Flink
>          Issue Type: New Feature
>          Components: Streaming
>    Affects Versions: 0.9
>            Reporter: Gyula Fora
>            Priority: Minor
>              Labels: starter
>
> The streaming API currently doesn't support a fold operator.
> This operator would work as the foldLeft method in Scala. This would allow 
> effective implementations in a lot of cases where a the simple reduce is 
> inappropriate due to different return types.



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

Reply via email to