Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

A new record for SlidingWindows will always be associated with two windows. If either of those windows already exist in the windows store, their aggregation will simply be updated to include the new record and no duplicate window will be added to the WindowStore. If the window does not exist, the correct aggregation will be calculated and . it will be put in the window store. For in-order records, the right window will always be empty . It and will be stored in the window store with its aggregate initialized to the user defined initializer, but its output will not be emitted until it contains a value. We store empty windows in order to make future lookups for overlapping windows simpler.created by the first record that comes after the current record and falls within that record's right window. 


The left window of in-order records and both windows for out-of-order records need to be updated with the values of records that have already been processed, assuming there are existing records that wall fall within these windows and that these windows do not already exist.   Because each record creates or contributes to one window that includes itself and one window that does not, we have the set of all possible windows stored in our WindowStore. Therefore, when we need to find an aggregation to create a new window, that aggregation is already stored somewhere in the WindowStore. Figure 2 illustrates how we will find the aggregation value for the new left window.

Figure 2



Finding the aggregate for the new right window (for out-of-order records) is similarly predictable, as shown inin figure 3.

Figure 3.


Aggregating for Existing Windows

When a new record falls within existing recordswindows, a scan is performed in the WindowStore to find windows that have a starting time of <= recordTime - windowSize. These windows will have their aggregations updated with the new record's value and will emit the new result. A thorough example can be found here.