Reputation: 3206
I am working with apache flink 1.6, and I am trying to implement a stateful processing function, which uses flink's operator state, es described here: https://ci.apache.org/projects/flink/flink-docs-release-1.6/dev/stream/state/state.html#stateful-source-functions
However, the example on this page will not compile for me:
So the reason for this is that checkpointedState.get()
will return a java.lang.Iterable
, and not a scala.collection.Iterable
. What is the reason for this? Have I made a mistake somewhere on the way, or is the example code wrong?
Upvotes: 0
Views: 242
Reputation: 1009
checkpointedState.get()
will return java.lang.Iterable because that the api of Flink checkpointing is programmed with java instead of scala.
It looks that the example is wrong and you can create an issue on JIRA for the community.
The solution is like what user826955 said, you can use scala.collection.JavaConversions._
to convert a java.lang.Iterable to a scala collection.
Upvotes: 1
Reputation: 3206
Ok I don't know, if this is supposed to be clear/taken as granted, but after adding this:
import scala.collection.JavaConversions._
I was able to use the java iterator as normal scala collection, and the example worked just fine.
Upvotes: 1