Azure Stream Analytics (ASA)
- Shantanu Sharma
- Dec 22, 2021
- 2 min read
Updated: Apr 10, 2022
Azure stream analytics job can read from various source eg. IOT, Eventhub, Blob Storage etc.
ASA job can run on azure cloud and can also be compiled and deployed on IoT edge device (select edge for hosting environment for this).

ASA have 5 different temporal windows:
Tumbling Window
Hopping Window
Sliding Window
Session Window
Snapshot Window
Tumbling Window:
Tumbling window are length repeated, they do not overlap, and an event cannot belong to more than one tumbling window.
Repeated: Yes
Overlap: No
Fixed Length: Yes


Hopping Window:
Hopping window hop forward in time by a fixed period and would be same as a Tumbling window if hop size is same as window size.
Repeated: Yes
Overlap: Yes
Fixed Length: Yes


Sliding Window:
Sliding windows output events only for points in time when the content of the window actually changes. In other words, when an event enters or exits the window. So, every window has at least one event and events can belong to more than one sliding window.
Repeated: Yes
Overlap: Yes
Fixed Length: Yes


Session Window
Session window functions group events that arrive at similar times, filtering out periods of time where there is no data. It has three main parameters: timeout, maximum duration, and partitioning key (optional).
A session window begins when the first event occurs. If another event occurs within the specified timeout from the last ingested event, then the window extends to include the new event. Otherwise if no events occur within the timeout, then the window is closed at the timeout.
If events keep occurring within the specified timeout, the session window will keep extending until maximum duration is reached. The maximum duration checking intervals are set to be the same size as the specified max duration. For example, if the max duration is 10, then the checks on if the window exceed maximum duration will happen at t = 0, 10, 20, 30, etc.
When a partition key is provided, the events are grouped together by the key and session window is applied to each group independently. This partitioning is useful for cases where you need different session windows for different users or devices.
Repeated: Yes
Overlap: No
Fixed Length: No


Snapshot Window:
Snapshot windows group events that have the same timestamp. Unlike other windowing types, which require a specific window function (such as SessionWindow, you can apply a snapshot window by adding System.Timestamp() to the GROUP BY clause.


Comments