This operator defines a window based on the time.

Parameter

  • size: The size of the window. Can be either a single number or a pair of a number and a time unit. Possible values for the unit are one of TimeUnit like SECONDS, NANOSECODS etc. - default time is milliseconds
  • advance: The advance how the window moves forward. Can be either a single number or a pair of a number and a time unit. Possible values for the unit are one of TimeUnit like SECONDS, NANOSECODS etc. - default time is milliseconds. default advance is 1
  • slide: The slide of the window. When using this parameter all elements in the windows will have the same starttimestamp (e.g. helpful for aggregations), while advance will not change the starttimestamp. Can be either a single number or a pair of a number and a time unit. Possible values for the unit are one of TimeUnit like SECONDS, NANOSECODS etc. - default time is milliseconds. default advance is 1

Example

/// sliding time window (notice: size and advance is directly based on the used timestamps. 
/// if they are in milliseconds (which is default), size and advance are in milliseconds too.
 output = TIMEWINDOW({
                  size = 5, 
                  advance = 1
                 }, input)
 
/// sliding time window with another time unit for size. 
/// size  is converted from seconds into milliseconds 
/// (since this is the default  time granularity). 
/// This means, size will be 5000 and advance will be 1
 output = TIME WINDOW({
                  size = [5, 'SECONDS'], 
                  advance = 1
                 }, input)
 
/// sliding time window with another time unit for size and advance. 
/// size  and advance are converted from seconds into milliseconds 
/// (since this is  the default time granularity). 
/// This means, size will be 5000 and  advance will be 1000
 output = TIMEWINDOW({
                  size = [5, 'SECONDS'], 
                  advance = [1, 'SECONDS']
                 }, input)

 /// sliding delta window, reduces time granularity to value of slide
 output = TIMEWINDOW({
                  size = 5, 
                  slide = 5
                 }, input)
  • No labels