[jira] [Created] (FLINK-18599) Compile error when use windowAll and TumblingProcessingTimeWindows

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[jira] [Created] (FLINK-18599) Compile error when use windowAll and TumblingProcessingTimeWindows

Shang Yuanchun (Jira)
henvealf created FLINK-18599:
--------------------------------

             Summary: Compile error when use windowAll and TumblingProcessingTimeWindows
                 Key: FLINK-18599
                 URL: https://issues.apache.org/jira/browse/FLINK-18599
             Project: Flink
          Issue Type: Bug
          Components: API / DataStream
    Affects Versions: 1.11.0
            Reporter: henvealf


Code:
{code:java}
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()

{code}
Compile failed:
{code:java}
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

{code}
 What went wrong?

 Thanks.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)