flink-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Aljoscha Krettek <aljos...@apache.org>
Subject Re: WindowFunction-extension, WindowedStream apply signature mismatch
Date Wed, 14 Dec 2016 12:41:57 GMT
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 <my.inputstream@gmail.com> 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
>
>

Mime
View raw message