This topic describes how to use the tumbling window function in Spark Streaming SQL.

What is a tumbling window?

By using tumbling windows, you assign each element to a window with the specified size. Generally, tumbling windows are fixed in size and do not overlap each other. For example, if a 5-minute tumbling window is defined, elements are assigned into windows based on time periods: [0:00, 0:05), [0:05, 0:10), and [0:10, 0:15).


GROUP BY TUMBLING (colName, windowDuration) 


SELECT avg(inv_quantity_on_hand) qoh
FROM kafka_inventory
GROUP BY TUMBLING (inv_data_time, interval 1 minute)