git.net

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

State in the Scala DataStream API


Hello,


I'm looking at the following page of the documentation

https://ci.apache.org/projects/flink/flink-docs-stable/dev/stream/state/state.html

particularly at this piece of code:


val stream: DataStream[(String, Int)] = ...

val counts: DataStream[(String, Int)] = stream
  .keyBy(_._1)
  .mapWithState((in: (String, Int), count: Option[Int]) =>
    count match {
      case Some(c) => ( (in._1, c), Some(c + in._2) )
      case None => ( (in._1, 0), Some(in._2) )
    })

How is the state clear/purge in this case for keys that no longer appear?


Thank you,

Juan



( ! ) Warning: include(msgfooter.php): failed to open stream: No such file or directory in /var/www/git/apache-flink-users/msg11241.html on line 102
Call Stack
#TimeMemoryFunctionLocation
10.0008358376{main}( ).../msg11241.html:0

( ! ) Warning: include(): Failed opening 'msgfooter.php' for inclusion (include_path='.:/var/www/git') in /var/www/git/apache-flink-users/msg11241.html on line 102
Call Stack
#TimeMemoryFunctionLocation
10.0008358376{main}( ).../msg11241.html:0