[jira] [Created] (FLINK-11817) DataStream API Tutorial uses deprecated fold function

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[jira] [Created] (FLINK-11817) DataStream API Tutorial uses deprecated fold function

Shang Yuanchun (Jira)
Michael Holler created FLINK-11817:
--------------------------------------

             Summary: DataStream API Tutorial uses deprecated fold function
                 Key: FLINK-11817
                 URL: https://issues.apache.org/jira/browse/FLINK-11817
             Project: Flink
          Issue Type: Bug
          Components: Documentation
    Affects Versions: 1.7.2
            Reporter: Michael Holler


{{WindowedStream.fold}} is a deprecated, but it's still recommended in the tutorial documentation:

[https://ci.apache.org/projects/flink/flink-docs-release-1.7/tutorials/datastream_api.html]

Specifically this sample:
{code:java}
DataStream<Tuple2<String, Long>> result = keyedEdits
    .timeWindow(Time.seconds(5))
    .fold(new Tuple2<>("", 0L), new FoldFunction<WikipediaEditEvent, Tuple2<String, Long>>() {
        @Override
        public Tuple2<String, Long> fold(Tuple2<String, Long> acc, WikipediaEditEvent event) {
            acc.f0 = event.getUser();
            acc.f1 += event.getByteDiff();
            return acc;
        }
    });{code}
WindowedStream suggests using {{WindowedStream.aggregate(AggregationFunction)}} instead, but as a beginner it's difficult to understand how to go about that.

Can someone who knows the right way to migrate this code please update the corresponding documentation?



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