Google Cloud Dataflow SDK for Java, version 1.9.1
Class AfterPane<W extends BoundedWindow>
- java.lang.Object
-
- com.google.cloud.dataflow.sdk.transforms.windowing.Trigger<W>
-
- com.google.cloud.dataflow.sdk.transforms.windowing.Trigger.OnceTrigger<W>
-
- com.google.cloud.dataflow.sdk.transforms.windowing.AfterPane<W>
-
- Type Parameters:
W
-BoundedWindow
subclass used to represent the windows used by thisTrigger
- All Implemented Interfaces:
- TriggerBuilder<W>, Serializable
@Experimental(value=TRIGGER) public class AfterPane<W extends BoundedWindow> extends Trigger.OnceTrigger<W>
Trigger
s that fire based on properties of the elements in the current pane.- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.google.cloud.dataflow.sdk.transforms.windowing.Trigger
Trigger.MergingTriggerInfo<W extends BoundedWindow>, Trigger.OnceTrigger<W extends BoundedWindow>, Trigger.OnElementContext, Trigger.OnMergeContext, Trigger.TriggerContext, Trigger.TriggerInfo<W extends BoundedWindow>
-
-
Field Summary
-
Fields inherited from class com.google.cloud.dataflow.sdk.transforms.windowing.Trigger
subTriggers
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods 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>
AfterPane<W>elementCountAtLeast(int countElems)
Creates a trigger that fires when the pane contains at leastcountElems
elements.boolean
equals(Object obj)
Trigger.OnceTrigger<W>
getContinuationTrigger(List<Trigger<W>> continuationTriggers)
Return theTrigger.getContinuationTrigger()
of thisTrigger
.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 givenTrigger
.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 byTrigger.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 anTrigger.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 anTrigger.shouldFire(com.google.cloud.dataflow.sdk.transforms.windowing.Trigger<W>.TriggerContext)
call.boolean
shouldFire(Trigger.TriggerContext context)
Returnstrue
if the current state of the trigger indicates that its condition is satisfied and it is ready to fire.String
toString()
-
Methods inherited from class com.google.cloud.dataflow.sdk.transforms.windowing.Trigger.OnceTrigger
getContinuationTrigger, onFire
-
Methods inherited from class com.google.cloud.dataflow.sdk.transforms.windowing.Trigger
buildTrigger, orFinally, prefetchOnElement, prefetchOnFire, subTriggers
-
-
-
-
Method Detail
-
elementCountAtLeast
public static <W extends BoundedWindow> AfterPane<W> elementCountAtLeast(int countElems)
Creates a trigger that fires when the pane contains at leastcountElems
elements.
-
onElement
public void onElement(Trigger.OnElementContext c) throws Exception
Description copied from class:Trigger
Called immediately after an element is first incorporated into a window.- Specified by:
onElement
in classTrigger<W extends BoundedWindow>
- Throws:
Exception
-
prefetchOnMerge
public void prefetchOnMerge(com.google.cloud.dataflow.sdk.util.state.MergingStateAccessor<?,W> state)
Description copied from class:Trigger
Called to allow the trigger to prefetch any state it will likely need to read from during anTrigger.onMerge(com.google.cloud.dataflow.sdk.transforms.windowing.Trigger<W>.OnMergeContext)
call.- Overrides:
prefetchOnMerge
in classTrigger<W extends BoundedWindow>
-
onMerge
public void onMerge(Trigger.OnMergeContext context) throws Exception
Description copied from class:Trigger
Called immediately after windows have been merged.Leaf 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 toTrigger.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.
- Specified by:
onMerge
in classTrigger<W extends BoundedWindow>
- Throws:
Exception
-
prefetchShouldFire
public void prefetchShouldFire(com.google.cloud.dataflow.sdk.util.state.StateAccessor<?> state)
Description copied from class:Trigger
Called to allow the trigger to prefetch any state it will likely need to read from during anTrigger.shouldFire(com.google.cloud.dataflow.sdk.transforms.windowing.Trigger<W>.TriggerContext)
call.- Overrides:
prefetchShouldFire
in classTrigger<W extends BoundedWindow>
-
shouldFire
public boolean shouldFire(Trigger.TriggerContext context) throws Exception
Description copied from class:Trigger
Returnstrue
if the current state of the trigger indicates that its condition is satisfied and it is ready to fire.- Specified by:
shouldFire
in classTrigger<W extends BoundedWindow>
- Throws:
Exception
-
clear
public void clear(Trigger.TriggerContext c) throws Exception
Description copied from class:Trigger
Clear any state associated with this trigger in the given window.This 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.
- Overrides:
clear
in classTrigger<W extends BoundedWindow>
- Throws:
Exception
-
isCompatible
public boolean isCompatible(Trigger<?> other)
Description copied from class:Trigger
Returns whether this performs the same triggering as the givenTrigger
.- Overrides:
isCompatible
in classTrigger<W extends BoundedWindow>
-
getWatermarkThatGuaranteesFiring
public Instant getWatermarkThatGuaranteesFiring(W window)
Description copied from class:Trigger
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. This is a static property of a trigger that does not depend on its state.For 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.
- Specified by:
getWatermarkThatGuaranteesFiring
in classTrigger<W extends BoundedWindow>
-
getContinuationTrigger
public Trigger.OnceTrigger<W> getContinuationTrigger(List<Trigger<W>> continuationTriggers)
Description copied from class:Trigger
Return theTrigger.getContinuationTrigger()
of thisTrigger
. For convenience, this is provided the continuation trigger of each of the sub-triggers.- Specified by:
getContinuationTrigger
in classTrigger<W extends BoundedWindow>
-
toString
public String toString()
- Overrides:
toString
in classTrigger<W extends BoundedWindow>
-
equals
public boolean equals(Object obj)
- Overrides:
equals
in classTrigger<W extends BoundedWindow>
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classTrigger<W extends BoundedWindow>
-
onOnlyFiring
protected void onOnlyFiring(Trigger.TriggerContext context) throws Exception
Description copied from class:Trigger.OnceTrigger
Called exactly once byTrigger.OnceTrigger.onFire(com.google.cloud.dataflow.sdk.transforms.windowing.Trigger<W>.TriggerContext)
when the trigger is fired. By default, invokesTrigger.OnceTrigger.onFire(com.google.cloud.dataflow.sdk.transforms.windowing.Trigger<W>.TriggerContext)
on all subtriggers for whichTrigger.shouldFire(com.google.cloud.dataflow.sdk.transforms.windowing.Trigger<W>.TriggerContext)
istrue
.- Specified by:
onOnlyFiring
in classTrigger.OnceTrigger<W extends BoundedWindow>
- Throws:
Exception
-
-