WindowFunction-extension, WindowedStream apply signature mismatch

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

WindowFunction-extension, WindowedStream apply signature mismatch

MIkkel Islay

(The following is a cross-post of a Stack Overflow question at https://stackoverflow.com/questions/41105142/windowfunction-extension-does-not-match-windowedstream-apply-signatures)

Why does the below error occur?

Given this extension to WindowFunction:

  class TestWinFunc extends WindowFunction[Top, Bottom, Long, TimeWindow] {
    override def apply(key: Long,
                       w: TimeWindow,
                       iterable: Iterable[Top],
                       collector: Collector[Bottom]): Unit = {
      collector.collect(Bottom(0.0,0.0,0.0,0.0,1L))
    }
  }

an apply transformation on a windowed stream:

    val bottom = inputstream
                .keyBy(_.stamp)
                .window(TumblingEventTimeWindows.of(Time.milliseconds(1)))
                .apply(new TestWinFunc)

yields the following error:

Error:overloaded method value apply with alternatives: [R](function: (Long, org.apache.flink.streaming.api.windowing.windows.TimeWindow, Iterable[Flink.ETL.Top], org.apache.flink.util.Collector[R]) => Unit)(implicit evidence$4: org.apache.flink.api.common.typeinfo.TypeInformation[R])org.apache.flink.streaming.api.scala.DataStream[R] [R](function: org.apache.flink.streaming.api.scala.function.WindowFunction[Flink.ETL.Top,R,Long,org.apache.flink.streaming.api.windowing.windows.TimeWindow])(implicit evidence$3: org.apache.flink.api.common.typeinfo.TypeInformation[R])org.apache.flink.streaming.api.scala.DataStream[R] cannot be applied to (Flink.ETL.TestWinFunc) .apply(new TestWinFunc)

The 'bottom' val argument to apply has type WindowedStream[Top, Long, TimeWindow].

Flink 1.1.3 / Scala 2.11

Thanks,

Mikkel


Reply | Threaded
Open this post in threaded view
|

Re: WindowFunction-extension, WindowedStream apply signature mismatch

Aljoscha Krettek
Hi,
are you using the WindowFunction in org.apache.flink.streaming.api.scala.function? It's a bit tricky because there is another WindowFunction in another package.

Cheers,
Aljoscha

On Tue, 13 Dec 2016 at 13:48 MIkkel Islay <[hidden email]> wrote:

(The following is a cross-post of a Stack Overflow question at https://stackoverflow.com/questions/41105142/windowfunction-extension-does-not-match-windowedstream-apply-signatures)

Why does the below error occur?

Given this extension to WindowFunction:

  class TestWinFunc extends WindowFunction[Top, Bottom, Long, TimeWindow] {
    override def apply(key: Long,
                       w: TimeWindow,
                       iterable: Iterable[Top],
                       collector: Collector[Bottom]): Unit = {
      collector.collect(Bottom(0.0,0.0,0.0,0.0,1L))
    }
  }

an apply transformation on a windowed stream:

    val bottom = inputstream
                .keyBy(_.stamp)
                .window(TumblingEventTimeWindows.of(Time.milliseconds(1)))
                .apply(new TestWinFunc)

yields the following error:

Error:overloaded method value apply with alternatives: [R](function: (Long, org.apache.flink.streaming.api.windowing.windows.TimeWindow, Iterable[Flink.ETL.Top], org.apache.flink.util.Collector[R]) => Unit)(implicit evidence$4: org.apache.flink.api.common.typeinfo.TypeInformation[R])org.apache.flink.streaming.api.scala.DataStream[R] [R](function: org.apache.flink.streaming.api.scala.function.WindowFunction[Flink.ETL.Top,R,Long,org.apache.flink.streaming.api.windowing.windows.TimeWindow])(implicit evidence$3: org.apache.flink.api.common.typeinfo.TypeInformation[R])org.apache.flink.streaming.api.scala.DataStream[R] cannot be applied to (Flink.ETL.TestWinFunc) .apply(new TestWinFunc)

The 'bottom' val argument to apply has type WindowedStream[Top, Long, TimeWindow].

Flink 1.1.3 / Scala 2.11

Thanks,

Mikkel