[ https://issues.apache.org/jira/browse/FLINK-3551?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15836698#comment-15836698 ]
ASF GitHub Bot commented on FLINK-3551: --------------------------------------- Github user fhueske commented on a diff in the pull request: https://github.com/apache/flink/pull/2761#discussion_r97206112 --- Diff: flink-examples/flink-examples-streaming/src/main/scala/org/apache/flink/streaming/scala/examples/iteration/IterateExample.scala --- @@ -0,0 +1,137 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.flink.streaming.scala.examples.iteration + +import java.util.Random + +import org.apache.flink.api.java.utils.ParameterTool +import org.apache.flink.api.scala._ +import org.apache.flink.streaming.api.functions.source.SourceFunction +import org.apache.flink.streaming.api.functions.source.SourceFunction.SourceContext +import org.apache.flink.streaming.api.scala.{DataStream, StreamExecutionEnvironment} + +/** + * Example illustrating iterations in Flink streaming. + * <p> The program sums up random numbers and counts additions + * it performs to reach a specific threshold in an iterative streaming fashion. </p> + * + * <p> + * This example shows how to use: + * <ul> + * <li>streaming iterations, + * <li>buffer timeout to enhance latency, + * <li>directed outputs. + * </ul> + * </p> + */ +object IterateExample { + + private val Bound = 100 + + def main(args: Array[String]): Unit = { + // Checking input parameters + val params = ParameterTool.fromArgs(args) + + // obtain execution environment and set setBufferTimeout to 1 to enable + // continuous flushing of the output buffers (lowest latency) + val env = StreamExecutionEnvironment.getExecutionEnvironment.setBufferTimeout(1) + + // make parameters available in the web interface + env.getConfig.setGlobalJobParameters(params) + + // create input stream of integer pairs + val inputStream = + if (params.has("input")) { + env.readTextFile(params.get("input")).map { value: String => --- End diff -- Please add a comment describing what the map function does > Sync Scala and Java Streaming Examples > -------------------------------------- > > Key: FLINK-3551 > URL: https://issues.apache.org/jira/browse/FLINK-3551 > Project: Flink > Issue Type: Sub-task > Components: Examples > Affects Versions: 1.0.0 > Reporter: Stephan Ewen > Assignee: Lim Chee Hau > > The Scala Examples lack behind the Java Examples -- This message was sent by Atlassian JIRA (v6.3.4#6332)