Hi Piyush,

that's not trivial to implement. You can only do that with a so-called
GlobalWindow, i.e., a window which receives all elements of a partition,
and a custom trigger which has state to decide whether it has triggered the
first window or not. It won't work with a CountTrigger.

Best, Fabian

2016-04-20 14:20 GMT+02:00 Piyush Shrivastava <piyush...@yahoo.co.in>:

> Hi Fabian,
>
> Thanks for the information. I also quickly want to ask that if I implement
> a custom trigger that fires in one hour for the first time and then every
> five minutes, what all functions do I need to use?
> I am considering creating my own trigger referring the code here:
>
> https://github.com/apache/flink/blob/master/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/windowing/triggers/CountTrigger.java
>
> What changes do I need to make? Is it even possible to do this?
>
> Thanks and Regards,
> Piyush Shrivastava <piy...@webograffiti.com>
> [image: WeboGraffiti]
> http://webograffiti.com
>
>
> On Wednesday, 20 April 2016 4:59 PM, Fabian Hueske <fhue...@gmail.com>
> wrote:
>
>
> Hi Piyush,
>
> if you explicitly set a trigger, the default trigger of the window is
> replaced.
> In your example, the time trigger is replaced by the count trigger, i.e.,
> the window is only evaluated after the 100th element was received.
>
> This blog post discusses windows and triggers [1].
>
> Best, Fabian
>
> [1] http://flink.apache.org/news/2015/12/04/Introducing-windows.html
>
> 2016-04-20 13:20 GMT+02:00 Piyush Shrivastava <piyush...@yahoo.co.in>:
>
> I wanted to know how Windows and Triggers work in Flink. I am creating a
> time window of 20 seconds and a count trigger of 100.
>
> stream.keyBy(0)
>              .timeWindow(Time.seconds(20))
>              .trigger(CountTrigger.of(100))
>
> In this case, when will my window get triggered? When 20 seconds has
> passed, 100 messages are passed?
>
> Thanks and Regards,
> Piyush Shrivastava <piy...@webograffiti.com>
> [image: WeboGraffiti]
> http://webograffiti.com
>
>
>
>
>

Reply via email to