Re: Window with recent messages

2018-04-11 Thread m@xi
Hello there Krzystzof! Thanks a lot for the answer. Sorry for the late reply. I can see the logic behind custom window processing in Flink. Once, an incoming tuple arrives, you add a timer to it, which is going to tick after "RatingExpiration" time units, as shown in your code. This, is made *fo

Re: Window with recent messages

2018-02-24 Thread Krzysztof Białek
Hi m@xi, There you have it (as concept, not run, not tested) https://gist.github.com/kbialek/c8fe098e2040f1d22a2a1e6f08ef9fa5 Note that your stream must contain watermarks. Otherwise EventTime timers won't be triggered. Regards, Krzysztof On Sat, Feb 24, 2018 at 10:00 AM, m@xi wrote: > Hi Krz

Re: Window with recent messages

2018-02-24 Thread m@xi
Hi Krzystzof, I want to do something which is very similar if not identical to yours. Apply sliding windows in my input streams by using "the swiss army knife" of Flink. If it is easy and not a problem for you, it would be great if you uploaded here the skeleton code of your solution. Thanks in

Re: Window with recent messages

2018-02-23 Thread Fabian Hueske
Hi Krzysztof, Thanks for sharing your solution! ProcessFunctions are the Swiss army knife of Flink :-) Cheers, Fabian 2018-02-22 19:55 GMT+01:00 Krzysztof Białek : > Hi Fabian, > > Thank you for your suggestion. In the meantime I rethought this problem > and implemented alternative solution wit

Re: Window with recent messages

2018-02-22 Thread Krzysztof Białek
Hi Fabian, Thank you for your suggestion. In the meantime I rethought this problem and implemented alternative solution without using windows at all. I used plain ProcessFunction with 1. Keyed state (by companyId) - to keep ratings per key 2. EventTime timers - to remove outdated ratings from stat

Re: Window with recent messages

2018-02-22 Thread Fabian Hueske
Hi Krzysztof, you could compute the stats in two stages: 1) compute an daily window. You should use a ReduceFunction or AggreagteFunction here if possible to perform the computation eagerly. 2) compute a sliding window of 90 days with a 1 day hop (or 90 rows with a 1 row hop). That will crunch d

Window with recent messages

2018-02-19 Thread Krzysztof Białek
Hi, My app is calculating Companies scores from Ratings given by users. Only ratings from last 90 days should be considered. 1. Is it possible to construct window processing ratings from last 90 days? I've started with *misusing* countWindow but this solution looks ugly for me. ratingStream .f