W - BoundedWindow subclass used to represent the windows used by this
Trigger@Experimental(value=TRIGGER) public class AfterPane<W extends BoundedWindow> extends Trigger.OnceTrigger<W>
Triggers that fire based on properties of the elements in the current pane.Trigger.MergingTriggerInfo<W extends BoundedWindow>, Trigger.OnceTrigger<W extends BoundedWindow>, Trigger.OnElementContext, Trigger.OnMergeContext, Trigger.TriggerContext, Trigger.TriggerInfo<W extends BoundedWindow>subTriggers| Modifier and Type | Method and Description |
|---|---|
void |
clear(Trigger.TriggerContext c)
Clear any state associated with this trigger in the given window.
|
static <W extends BoundedWindow> |
elementCountAtLeast(int countElems)
Creates a trigger that fires when the pane contains at least
countElems elements. |
boolean |
equals(Object obj) |
Trigger.OnceTrigger<W> |
getContinuationTrigger(List<Trigger<W>> continuationTriggers)
Return the
Trigger.getContinuationTrigger() of this Trigger. |
Instant |
getWatermarkThatGuaranteesFiring(W window)
Returns a bound in watermark time by which this trigger would have fired at least once
for a given window had there been input data.
|
int |
hashCode() |
boolean |
isCompatible(Trigger<?> other)
Returns whether this performs the same triggering as the given
Trigger. |
void |
onElement(Trigger.OnElementContext c)
Called immediately after an element is first incorporated into a window.
|
void |
onMerge(Trigger.OnMergeContext context)
Called immediately after windows have been merged.
|
protected void |
onOnlyFiring(Trigger.TriggerContext context)
Called exactly once by
Trigger.OnceTrigger.onFire(com.google.cloud.dataflow.sdk.transforms.windowing.Trigger<W>.TriggerContext) when the trigger is fired. |
void |
prefetchOnMerge(com.google.cloud.dataflow.sdk.util.state.MergingStateAccessor<?,W> state)
Called to allow the trigger to prefetch any state it will likely need to read from during
an
Trigger.onMerge(com.google.cloud.dataflow.sdk.transforms.windowing.Trigger<W>.OnMergeContext) call. |
void |
prefetchShouldFire(com.google.cloud.dataflow.sdk.util.state.StateAccessor<?> state)
Called to allow the trigger to prefetch any state it will likely need to read from during
an
Trigger.shouldFire(com.google.cloud.dataflow.sdk.transforms.windowing.Trigger<W>.TriggerContext) call. |
boolean |
shouldFire(Trigger.TriggerContext context)
Returns
true if the current state of the trigger indicates that its condition
is satisfied and it is ready to fire. |
String |
toString() |
getContinuationTrigger, onFirebuildTrigger, orFinally, prefetchOnElement, prefetchOnFire, subTriggerspublic static <W extends BoundedWindow> AfterPane<W> elementCountAtLeast(int countElems)
countElems elements.public void onElement(Trigger.OnElementContext c) throws Exception
TriggeronElement in class Trigger<W extends BoundedWindow>Exceptionpublic void prefetchOnMerge(com.google.cloud.dataflow.sdk.util.state.MergingStateAccessor<?,W> state)
TriggerTrigger.onMerge(com.google.cloud.dataflow.sdk.transforms.windowing.Trigger<W>.OnMergeContext) call.prefetchOnMerge in class Trigger<W extends BoundedWindow>public void onMerge(Trigger.OnMergeContext context) throws Exception
TriggerLeaf triggers should update their state by inspecting their status and any state
in the merging windows. Composite triggers should update their state by calling
ExecutableTrigger.invokeOnMerge(com.google.cloud.dataflow.sdk.transforms.windowing.Trigger<W>.OnMergeContext) on their sub-triggers, and applying appropriate logic.
A trigger such as AfterWatermark.pastEndOfWindow() may no longer be finished;
it is the responsibility of the trigger itself to record this fact. It is forbidden for
a trigger to become finished due to Trigger.onMerge(com.google.cloud.dataflow.sdk.transforms.windowing.Trigger<W>.OnMergeContext), as it has not yet fired the pending
elements that led to it being ready to fire.
The implementation does not need to clear out any state associated with the old windows.
onMerge in class Trigger<W extends BoundedWindow>Exceptionpublic void prefetchShouldFire(com.google.cloud.dataflow.sdk.util.state.StateAccessor<?> state)
TriggerTrigger.shouldFire(com.google.cloud.dataflow.sdk.transforms.windowing.Trigger<W>.TriggerContext) call.prefetchShouldFire in class Trigger<W extends BoundedWindow>public boolean shouldFire(Trigger.TriggerContext context) throws Exception
Triggertrue if the current state of the trigger indicates that its condition
is satisfied and it is ready to fire.shouldFire in class Trigger<W extends BoundedWindow>Exceptionpublic void clear(Trigger.TriggerContext c) throws Exception
TriggerThis is called after a trigger has indicated it will never fire again. The trigger system keeps enough information to know that the trigger is finished, so this trigger should clear all of its state.
clear in class Trigger<W extends BoundedWindow>Exceptionpublic boolean isCompatible(Trigger<?> other)
TriggerTrigger.isCompatible in class Trigger<W extends BoundedWindow>public Instant getWatermarkThatGuaranteesFiring(W window)
TriggerFor triggers that do not fire based on the watermark advancing, returns
BoundedWindow.TIMESTAMP_MAX_VALUE.
This estimate is used to determine that there are no elements in a side-input window, which causes the default value to be used instead.
getWatermarkThatGuaranteesFiring in class Trigger<W extends BoundedWindow>public Trigger.OnceTrigger<W> getContinuationTrigger(List<Trigger<W>> continuationTriggers)
TriggerTrigger.getContinuationTrigger() of this Trigger. For convenience, this
is provided the continuation trigger of each of the sub-triggers.getContinuationTrigger in class Trigger<W extends BoundedWindow>public String toString()
toString in class Trigger<W extends BoundedWindow>public boolean equals(Object obj)
equals in class Trigger<W extends BoundedWindow>public int hashCode()
hashCode in class Trigger<W extends BoundedWindow>protected void onOnlyFiring(Trigger.TriggerContext context) throws Exception
Trigger.OnceTriggerTrigger.OnceTrigger.onFire(com.google.cloud.dataflow.sdk.transforms.windowing.Trigger<W>.TriggerContext) when the trigger is fired. By default,
invokes Trigger.OnceTrigger.onFire(com.google.cloud.dataflow.sdk.transforms.windowing.Trigger<W>.TriggerContext) on all subtriggers for which Trigger.shouldFire(com.google.cloud.dataflow.sdk.transforms.windowing.Trigger<W>.TriggerContext) is true.onOnlyFiring in class Trigger.OnceTrigger<W extends BoundedWindow>Exception