Re-adding user mailing list to CC Hi,
> I basically understand your meaning, as far as my understanding, we can write > a custom window assigner and custom trigger, and we can register the timer > when the window process elements. No I was actually suggesting to write your own operator to do that. My bet is that hacking window operator to make it re-emit the same result in case of no data would be more difficult if not even impossible, while your custom “ReEmitLastRow” operator should be relatively simple. > But How can we register a timer when no elements received during a time > window? Upon first element register timer for N seconds in the future. Once it fires, register next one (you can do that while processing a timer callback) again for N seconds in the future and so on. Piotrek > On 8 Nov 2018, at 07:44, yinhua.2...@outlook.com wrote: > > Hi Piotr, > > Thank you for your explanation. > I basically understand your meaning, as far as my understanding, we can write > a custom window assigner and custom trigger, and we can register the timer > when the window process elements. > > But How can we register a timer when no elements received during a time > window? > My requirement is to always fire at end of the time window even no result > from the sql query. > On 7 Nov 2018, at 09:48, Piotr Nowojski <pi...@data-artisans.com> wrote: > > Hi, > > You would have to register timers (probably based on event time). > > Your operator would be a vastly simplified window operator, where for given > window you keep emitted record from your SQL, sth like: > > MapState<Timestamp, Record> emittedRecords; // map window start -> emitted > record > > When you process elements, you just put them into this map. To emit the > results, you just register event time timers and when a timer fires, you > search in the map for the latest record matching the timer's event time > (there might be many elements in the map, some of them older some of them > newer then the fired timer). You can/should also prune the state in the same > timer - for example after emitting the result drop all of the windows older > then the timer. > > Piotrek > >> On 7 Nov 2018, at 02:55, yinhua.dai <yinhua.2...@outlook.com> wrote: >> >> Hi Piotr, >> >> Can you elaborate more on the solution with the custom operator? >> I don't think there will be any records from the SQL query if no input data >> in coming in within the time window even if we convert the result to a >> datastream. >> >> >> >> -- >> Sent from: >> http://apache-flink-user-mailing-list-archive.2336050.n4.nabble.com/ >