diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/transformations/FeedbackTransformation.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/transformations/FeedbackTransformation.java index 03a4e52955743..2e4f8a93eaf2d 100644 --- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/transformations/FeedbackTransformation.java +++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/transformations/FeedbackTransformation.java @@ -87,7 +87,8 @@ public void addFeedbackEdge(StreamTransformation transform) { throw new UnsupportedOperationException( "Parallelism of the feedback stream must match the parallelism of the original" + " stream. Parallelism of original stream: " + this.getParallelism() + - "; parallelism of feedback stream: " + transform.getParallelism()); + "; parallelism of feedback stream: " + transform.getParallelism() + + ". Parallelism can be modified using DataStream#setParallelism() method"); } feedbackEdges.add(transform); diff --git a/flink-streaming-scala/pom.xml b/flink-streaming-scala/pom.xml index df58d6d53a042..316731a5de4a1 100644 --- a/flink-streaming-scala/pom.xml +++ b/flink-streaming-scala/pom.xml @@ -228,6 +228,10 @@ under the License. *\$\$anon\$* + + + org.apache.flink.streaming.api.scala.DataStream#iterate\$default\$3() diff --git a/flink-streaming-scala/src/main/scala/org/apache/flink/streaming/api/scala/DataStream.scala b/flink-streaming-scala/src/main/scala/org/apache/flink/streaming/api/scala/DataStream.scala index 3875f669cba18..63a2d5d37bc00 100644 --- a/flink-streaming-scala/src/main/scala/org/apache/flink/streaming/api/scala/DataStream.scala +++ b/flink-streaming-scala/src/main/scala/org/apache/flink/streaming/api/scala/DataStream.scala @@ -499,23 +499,22 @@ class DataStream[T](stream: JavaStream[T]) { * stepfunction: initialStream => (feedback, output) * * A common pattern is to use output splitting to create feedback and output DataStream. - * Please refer to the .split(...) method of the DataStream + * Please refer to the [[split]] method of the DataStream * * By default a DataStream with iteration will never terminate, but the user * can use the maxWaitTime parameter to set a max waiting time for the iteration head. * If no data received in the set time the stream terminates. * - * By default the feedback partitioning is set to match the input, to override this set - * the keepPartitioning flag to true - * + * Parallelism of the feedback stream must match the parallelism of the original stream. + * Please refer to the [[setParallelism]] method for parallelism modification */ @PublicEvolving def iterate[R](stepFunction: DataStream[T] => (DataStream[T], DataStream[R]), - maxWaitTimeMillis:Long = 0, - keepPartitioning: Boolean = false) : DataStream[R] = { + maxWaitTimeMillis:Long = 0) : DataStream[R] = { val iterativeStream = stream.iterate(maxWaitTimeMillis) val (feedback, output) = stepFunction(new DataStream[T](iterativeStream)) + iterativeStream.closeWith(feedback.javaStream) output }