[ 
https://issues.apache.org/jira/browse/FLINK-3551?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15836694#comment-15836694
 ] 

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_r97658665
  
    --- Diff: 
flink-examples/flink-examples-streaming/src/main/scala/org/apache/flink/streaming/scala/examples/windowing/SessionWindowing.scala
 ---
    @@ -0,0 +1,94 @@
    +/*
    + * 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.windowing
    +
    +import org.apache.flink.api.java.utils.ParameterTool
    +import org.apache.flink.api.scala._
    +import org.apache.flink.streaming.api.TimeCharacteristic
    +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.StreamExecutionEnvironment
    +import org.apache.flink.streaming.api.watermark.Watermark
    +import 
org.apache.flink.streaming.api.windowing.assigners.EventTimeSessionWindows
    +import org.apache.flink.streaming.api.windowing.time.Time
    +
    +/**
    +  * An example of grouped stream windowing in session windows with session 
timeout of 3 msec.
    +  * A source fetches elements with key, timestamp, and count.
    +  */
    +object SessionWindowing {
    +
    +  def main(args: Array[String]): Unit = {
    +
    +    val params = ParameterTool.fromArgs(args)
    +    val env = StreamExecutionEnvironment.getExecutionEnvironment
    +
    +    env.getConfig.setGlobalJobParameters(params)
    +    env.setStreamTimeCharacteristic(TimeCharacteristic.EventTime)
    +    env.setParallelism(1)
    +
    +    val fileOutput = params.has("output")
    +
    +    val input = List(
    +      ("a", 1L, 1),
    +      ("b", 1L, 1),
    +      ("b", 3L, 1),
    +      ("b", 5L, 1),
    +      ("c", 6L, 1),
    +      // We expect to detect the session "a" earlier than this point (the 
old
    +      // functionality can only detect here when the next starts)
    +      ("a", 10L, 1),
    +      // We expect to detect session "b" and "c" at this point as well
    +      ("c", 11L, 1)
    +    )
    +
    +    val source = env.addSource(new SourceFunction[(String, Long, Int)]() {
    +
    +      override def run(ctx: SourceContext[(String, Long, Int)]): Unit = {
    +        input.foreach(value => {
    +          ctx.collectWithTimestamp(value, value._2)
    +          ctx.emitWatermark(new Watermark(value._2 - 1))
    +          if (!fileOutput) {
    --- End diff --
    
    I'd remove this condition. Not sure how much value the printed values add 
to the example.


> 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)

Reply via email to