Windowing is a very common operation in stream analytics.
Beneath the surface, there is a whole bunch of complex data structuring that’s going on to support the windowing operations. I would love to dig deeper into these someday.
Here is an example of a query I wrote recently using windowing operators in azure stream analytics. It shows 3 interesting things :
3. Aggregation over string columns (using TopOne)
WITH ContextReward AS ( SELECT eventid, TopOne() OVER (ORDER BY [EventEnqueuedUtcTime] ASC) CR, MAX (reward) AS reward FROM Input GROUP BY eventid, HoppingWindow(Duration(hour, 2), Hop(hour, 1)) ) SELECT reward, eventid, CR.actionname AS actionname, CR.age AS age, CR.gender AS gender, CR.weight AS weight, CR.actionprobability INTO OutputWindow FROM ContextReward SELECT * INTO Output FROM Input SELECT * INTO OutputCSV FROM Input