The predicate window opens and closes the window regarding a start and optional an end condition.
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!
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)
closeWindowWithHeartbeat:if true, the window is closed when a heartbeat is received. Take a look at the session window to see how it works.
Remark: This is a blocking operator. The operator does not write elements before it sees new elements not belonging to the window anymore (similiar to ElementWindow)
In the following we provide some examples and the corresponding output.
As input, we assume the following simple input:
With some preprocessing
we will get:
Using only a start predicate
will result in:
Here the window is opened for every true evaluation of the start condition and is closed for every evaluation of !start. All elements between these elements are discarded. They do not open a new window.
Using a start and an end predicate
Here each time a new window opens, the old window is closed, i.e. the same input element is responsible for starting and closing a window.
Using a start and an end predicate and keeping the ending element:
will result in:
Remark the difference: This operator blocks only until the end predicate is reached. This works only, if samestarttime is set to true, else e.g. A|4|true|false | META | 1|4 would be A|4|true|false | META | 4|4, this has no validitiy and will not be produced.