Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Not A Bug
-
1.11.0
-
None
-
None
Description
Code:
import org.apache.commons.lang3.StringUtils import org.apache.flink.streaming.api.scala.StreamExecutionEnvironment import org.apache.flink.streaming.api.windowing.assigners.{TumblingProcessingTimeWindows} import org.apache.flink.streaming.api.windowing.time.Time import org.apache.flink.streaming.api.scala._ val env = StreamExecutionEnvironment.getExecutionEnvironment val stream = env.fromElements("a", "b", "c") stream .filter((str: String) => StringUtils.isNotEmpty(str)) .map( _ => 1) .windowAll(TumblingProcessingTimeWindows.of(Time.seconds(5))) .reduce((a1, a2) => a1 + a2) .print()
Compile failed:
error: type mismatch; found : org.apache.flink.streaming.api.windowing.assigners.TumblingProcessingTimeWindows required: org.apache.flink.streaming.api.windowing.assigners.WindowAssigner[_ >: Int, ?] Note: Object <: Any (and org.apache.flink.streaming.api.windowing.assigners.TumblingProcessingTimeWindows <: org.apache.flink.streaming.api.windowing.assigners.WindowAssigner[Object,org.apache.flink.streaming.api.windowing.windows.TimeWindow]), but Java-defined class WindowAssigner is invariant in type T. You may wish to investigate a wildcard type such as `_ <: Any`. (SLS 3.2.10) .windowAll(TumblingProcessingTimeWindows.of(Time.seconds(5))) ^ one error found
What went wrong?
Scala version: 2.11
Flink version: 1.11
Thanks.