OK, I see. But what if a window contains no elements? Is it still get fired and invoke the window function?
2017-12-12 15:42 GMT+08:00 Fabian Hueske <fhue...@gmail.com>: > Hi, > > this depends on the window type. Tumbling and Sliding Windows are (by > default) aligned with the epoch time (1970-01-01 00:00:00). > For example a tumbling window of 2 hour starts and ends every two hours, > i.e., from 12:00:00 to 13:59:59.999, from 14:00:00 to 15:59:59.999, etc. > > The documentation says a window is created when an element arrives. This > does not imply that the start time of the window is the time of the first > element. > So it might happen that the first element of a 2 hour tumbling window > arrives at 13:59:59.000 and the window is closed 1 second later. > > However, there are also windows for which the first element defines the > start time such as the built-in session window. > You can also define custom windows like that. > > Best, Fabian > > 2017-12-12 7:57 GMT+01:00 Jinhua Luo <luajit...@gmail.com>: >> >> Hi All, >> >> The document said "a window is created as soon as the first element >> that should belong to this window arrives, and the window is >> completely removed when the time (event or processing time) passes its >> end timestamp plus the user-specified allowed lateness (see Allowed >> Lateness).". >> >> I am still confused. >> >> If the window contains only one element (which triggers the window >> creation), and no more elements come in during the window size (e.g. 1 >> minute), then when does the window function get invoked? after 1 >> minute? >> >> I mean, the window would finish either when any element indicates the >> watermark is larger than the window size, or, when the processing time >> (no matter for event-timed window or process-timed window) pass over >> the window size since the first element? > >