zhipeng93 commented on code in PR #90:
URL: https://github.com/apache/flink-ml/pull/90#discussion_r860683058


##########
flink-ml-core/src/main/java/org/apache/flink/ml/common/datastream/DataStreamUtils.java:
##########
@@ -67,6 +72,28 @@ public static <IN, OUT> DataStream<OUT> mapPartition(
                 .setParallelism(input.getParallelism());
     }
 
+    /**
+     * Applies a {@link ReduceFunction} on a bounded data stream. The output 
stream contains at most
+     * one stream record and its parallelism is one.
+     *
+     * @param input The input data stream.
+     * @param func The user defined reduce function.
+     * @param <T> The class type of the input.
+     * @return The result data stream.
+     */
+    public static <T> DataStream<T> reduce(DataStream<T> input, 
ReduceFunction<T> func) {
+        DataStream<T> partialReducedStream =
+                input.transform("partialReduce", input.getType(), new 
ReduceOperator<>(func))
+                        .setParallelism(input.getParallelism());

Review Comment:
   Yeah, you are right and it is not chained. But from the job graph, I could 
see that the edge is already `FORWARD` and there is no network shuffle.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to