Uploaded image for project: 'Flink'
  1. Flink
  2. FLINK-18599

Compile error when use windowAll and TumblingProcessingTimeWindows

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Not A Bug
    • 1.11.0
    • None
    • API / Scala
    • 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.

      Attachments

        Activity

          People

            Unassigned Unassigned
            henvealf henvealf
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: