I am playing with Apache beam's MinimalWordCount, but compiler complains
[error] found : org.apache.beam.sdk.transforms.SimpleFunction[org.apache.beam.sdk.values.KV[String,Long],String]
[error] required: org.apache.beam.sdk.transforms.SimpleFunction[org.apache.beam.sdk.values.KV[String,Long],?]
[error] MapElements.via(new SimpleFunction[KV[String, Long], String]() {
I am not sure what goes wrong because the code have return type configured to String as type parameter, and the code is exactly the same as MinimalWordCount, except that is written in scala version.
apply("FormatResults",
MapElements.via(new SimpleFunction[KV[String, Long], String]() {
override def apply(input: KV[String, Long]): String =
input.getKey.toString + ": " + input.getValue.toString
})
)
Maybe I am missing some concepts in type system? How can I fix this error?
I use scala 2.11.x, sbt 0.13.11, java 1.8.0_91.
Thanks