yunfengzhou-hub commented on code in PR #90:
URL: https://github.com/apache/flink-ml/pull/90#discussion_r860633366
##########
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:
So far as I can see from the `JobGraph` of
`LinearRegressionTest.testFitAndPredict`, `partialReduce` is a separate job
vertex that is not chained with others yet.
--
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]