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/