Details
-
Improvement
-
Status: Closed
-
Major
-
Resolution: Won't Fix
-
0.10.0
-
None
Description
It is not possible to use a Scala Int as a KeyValueState in a Trigger function because TriggerContext.getKeyValueState requires that the state is Serializable.
override def onElement(e: (Int, Short), t: Long, w: TimeWindow, ctx: TriggerContext): TriggerResult = { val cnt = ctx.getKeyValueState[Int]("cnt", 0) ... }
will fail with
Error:(116, 44) type arguments [Int] do not conform to method getKeyValueState's type parameter bounds [S <: java.io.Serializable] val cnt = ctx.getKeyValueState[Int]("cnt", 0) ^
If I change Int to Integer, the code compiles.