Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The operator works as follows:

  • It first checks, if the maxWindowTime is reached. In this case all internal buffers for each group is cleared, where the first element is older than the given threashold.
  • The operator determines the group (partition) for the current input.
  • After that, if set, the clear condition is checked for the current group and the current input.
  • If the window for this group is already opened the next step is to check,
    • if the end condition is true. Then the operator creates an output. Typically, the whole window is written and the buffer is cleared. With the clear and advanceWhen condition, this behaviour can be changed.
    • if the end condition is false, the current element is added to the window and kept inside the operator.
  • If the window for this group is not opened, the start condition is checked. It the condition is true, the operator opens a new window and adds the current element to the window.

For the output there are different configurations:

  • samestarttime: Each element in the output will get the same starttime, i.e. the starttime from the first element
  • nesting: In Odysseus the output is typically a set of elements that are send one after the other. If this flag is set to true, the output of the window is a single list, with all elements from the window. This can be advantage, if the processing afterwards treats the elements together (e.g. in a MAP-Operation).  Samestarttimestamp Samestarttime sets the time for each element in the list, the list get the union of all intervals inside the list.

So simulate some kind of sliding window, the following parameters are used:

  • AdvanceWhen: This condition checks, if the window should move, i.e. if elements in the current buffer (for the current group) should be removed. If this predicate evalutes to true, the next parameter is used to determine which number of elements the move of the window should be
  • AdvanceSize: This size tells the operator if cases of AdvanceWhen is true, how many elements should be removed from the start of the current window. If the value is below 0 or the current window has less elements that this value, the buffer is cleared.

Remark: Advance is only used, if an output is generated and will be used after the results are produced. To clear the buffer independent of an output, clear needs to be used.

Parameters

  • 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. The tuple for which this condition is evaluated to true is only part of the result, if keepEndingElement is set to true!
  • clear: If this parameter is set, the window will only be cleared, if the condition is true. By this, the same element can be part of multiple windows (sliding)
  • sameStartTime: For predicate windows: If set to true, all produced elements get the same start timestamp
  • size: The maximum 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 the base time of the stream (typically milliseconds)
  • keepEndingElement: Typically, the object that fulfils the end condition will not be part of the result. If setting this attribute to true, the element will be part

  • partition: Evaluate the predicates on partitioned defined by different values of this attribute (similar to group by in aggreation)

  • useElementOnlyForStartOrEnd: Typically, an object is only used to evaluate the start or the end condition. If this value is set to true, an element can be used for both and can be part of multiple windows.
  • keepTimeOrder: If set to false, the output could be out of order.
  • closeWindowWithHeartbeat: if true, the window is closed when a heartbeat is received. Take a look at the session window to see how it works.

...