You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "Fabian Hueske (JIRA)" <ji...@apache.org> on 2015/11/18 17:40:11 UTC
[jira] [Created] (FLINK-3039) Trigger KeyValueState cannot be Scala
Int
Fabian Hueske created FLINK-3039:
------------------------------------
Summary: Trigger KeyValueState cannot be Scala Int
Key: FLINK-3039
URL: https://issues.apache.org/jira/browse/FLINK-3039
Project: Flink
Issue Type: Improvement
Affects Versions: 0.10.0
Reporter: Fabian Hueske
Fix For: 1.0.0
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.
{code}
override def onElement(e: (Int, Short), t: Long, w: TimeWindow, ctx: TriggerContext): TriggerResult = {
val cnt = ctx.getKeyValueState[Int]("cnt", 0)
...
}
{code}
will fail with
{code}
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)
^
{code}
If I change {{Int}} to {{Integer}}, the code compiles.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)