Rolling up data by time in SQL
date_trunc
call,
in streaming SQL you’d use a tumbling window.
In Arroyo windowing is enabled via special UDFs, in this case TUMBLE()
.
For example, to get the number of distinct auction IDs across bids for each minute,
you’d write a query like
TUMBLE()
function.
The resulting records will have a timestamp of
the end of the window minus 1 nanosecond.
HOP()
function is used to create sliding windows.
It takes two arguments, the first is the slide and the second is the window size.
For example, to get the number of distinct auction IDs across bids for the previous minute every second,
you’d write a query like
SESSION()
function is used to create session windows.
For example, to get the number of distinct auction IDs across bids for each session,