Table-Valued Functions

Table-Valued Functions create time-bounded windows of your data that allow you to perform aggregations. See the windowing documentation for more information.

SQL Function Description

TUMBLE(TABLE data, DESCRIPTOR(timecol), size)

Tumble creates adjoining windows of equal size. It counts each input event in exactly one window.

HOP(TABLE data, DESCRIPTOR(timecol), slide, size)

Hop creates windows of equal size which may overlap. For this reason, an input event may be present in more than one window. Hopping windows are also known as "sliding windows."

CUMULATE(TABLE data, DESCRIPTOR(timecol), step, size)

Cumulate creates cumulative windows of increasing size from the same start time until a maximum window size is reached. At that point, the previous window is closed and a new one is opened. Input events may be counted in more than one window.

SESSION(TABLE data [PARTITION BY(keycols, …​)], DESCRIPTOR(timecol), gap)

Session creates windows which model sessions of activity. Session windows do not overlap and do not have a fixed start and end time. Instead, a session window closes when it doesn’t receive elements for a certain period of time, i.e., when a gap of inactivity occurred.