This topic describes the window functions that Spark Streaming SQL supports and the time attribute of the functions.

Window functions

A window function is the aggregation over a specific window. For example, you can define a window to collect the number of clicks on a website in the last minute and calculate the data in the window. Spark Streaming SQL supports the following two types of windows:

Time attribute

Spark SQL uses the event time attribute to aggregate data in a window.

The event time attribute defines the time when each data entry is created. It is provided in the schema.


When you query an existing time window, the window function automatically generates a window column. This column contains window.start (start time) and window.end (end time).