Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

The window sets – dependent on the used parameters – the validity of the tuple. If a time based window is used, the default time granularity is in milliseconds. So, if you have another time granularity, you may use the unit-parameter (e.g. use 5 for size and SECONDS for the unit parameter) or you have to adjust the arity (e.g. use 5000 for size without the unit parameter)

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. helful 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
  • type: The type of the window. The possible values are Time, Tuple, Predicate, and Unbound
  • partition: The partition attribute of the window
  • start: The start condition for a predicate window. If the condition evaluates to true, the windows is opened until the end predicate evaluates to true (or if not given the start predicate evaluates to false). Note, that all elements that are not inside a window are send to ouput port 1
  • end: The end condition for a predicate window
  • sameStartTime: For predicate windows: If set to true, all produced elements get the same start timestamp

Example

Code Block
themeEclipse
languagejavascript
titleWindow Operator
linenumberstrue
//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 = WINDOW({
                  size = 5, 
                  advance = 1, 
                  type = 'time'
                 }, 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 = WINDOW({
                  size = [5, 'SECONDS'], 
                  advance = 1, 
                  type = 'time'
				 }, 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 = WINDOW({
                  size = [5, 'SECONDS'], 
                  advance = [1, 'SECONDS'], 
                  type = 'time',
                 }, input)

//sliding tuple window partitioned over bidder
 output = WINDOW({
                  size = 5, 
                  advance = 1, 
                  type = 'tuple', 
                  partition=['bidder']
                 }, input) 

 //unbounded window
 output = WINDOW({
                  type = 'unbounded'
                 }, input) 

 //now window (size = 1, advance = 1)
 output = WINDOW({
                  type = 'time'
                 }, input)

 //sliding delta window, reduces time granularity to value of slide
 output = WINDOW({
                  size = 5, 
                  type = 'time', 
                  slide = 5
                 }, input)

 // Predicate window
 output = WINDOW({
                  start = 'a > 10 and a < 20', 
				  type = 'Predicate'
				 }, input)
 output = WINDOW({
                  start = 'a = 11',
				  end = 'a = 20',
				  type = 'Predicate'
				 }, input)