Q:

ProcessWindowFunction#process is not called

I have a simple code as follows,when I run it within IDE, nothing is printed on the console, could some one help take a look?  Thanks
import org.apache.flink.api.java.tuple. Tuple
import org.apache.flink.streaming.api.scala._ 
import org.apache.flink.streaming.api. TimeCharacteristic
import org.apache.flink.streaming.api.scala. StreamExecutionEnvironment
import org.apache.flink.streaming.api.scala.function. ProcessWindowFunction
import org.apache.flink.streaming.api.windowing.time. Time
import org.apache.flink.streaming.api.windowing.windows. TimeWindow
import org.apache.flink.util. Collector

object WindowTest {

  def main(args: Array[String]): Unit = {
    val env = StreamExecutionEnvironment.getExecutionEnvironment
    env.setStreamTimeCharacteristic(TimeCharacteristic. ProcessingTime)
    val ds = env.fromElements(
      (1, "a"), (2, "b"), (3, "c"), (4, "e"), (5, "f"), (6, "g"), (7, "h"), (8, "g"), (1, "1a"), (2, "2b"), (3, "3c"), (4, "4e"), (5, "5f"), (6, "g"), (7, "h"), (8, "g")
    )
    val ds2 = ds.keyBy(0).timeWindow(Time.seconds(10))
      .process(new ProcessWindowFunction[(Int, String), String, Tuple, TimeWindow] {
        override def process(key: Tuple, context: Context, elements: Iterable[(Int, String)], out: Collector[String]): Unit = {
          val k = key.getField[Int](0)
          val w = context.window
          val start = w.getStart
          val end = w.getEnd
          val hc = context.window.hashCode()
          //NOT CALLED
          println(s"k=$k,start=$start, end=$end,hc=$hc")
        }
      })
    ds2.print() 
    env.execute()

    Thread.sleep(30 * 1000)

  }

}

A:

Your ProcessWindowFunction is never called because the window is never triggered.  It's never triggered because it runs to completion in a couple of milliseconds (roughly speaking), so it's very unlikely to be running at a moment when the system clock time is exactly at a 10 second boundary, which is what would have to happen for this processing time window to be triggered.