Shows how perform nested aggregation. The sample allows you to monitor
the current best and worst performers of a stock market by tracking the
movement of all the stock prices. It takes two levels of aggregation to
achieve this:
-
calculate the linear trend of stock price over a sliding window
-
take each sliding window result (one item per traded stock) and
find the items with the top/bottom values of the linear trend
All the items belonging to a given position of the sliding window have
the same timestamp (time when the window ends). The second-level
aggregation must set up its window so that a single window position
captures all the results of the first level with the same timestamp. The
time difference between the consecutive results is equal to the sliding
step we configured. This is why the second level uses a tumbling window
with size equal to the first level's sliding step.