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

Compile error when use windowAll and TumblingProcessingTimeWindows

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Not A Bug
    • Affects Version/s: 1.11.0
    • Fix Version/s: None
    • Component/s: API / Scala
    • Labels:
      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

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

              Dates

              • Created:
                Updated:
                Resolved: