public static class AfterWatermark.AfterWatermarkEarlyAndLate extends Trigger
AfterWatermark,
Serialized FormTrigger.MergingTriggerInfo, Trigger.OnceTrigger, Trigger.OnElementContext, Trigger.OnMergeContext, Trigger.TriggerContext, Trigger.TriggerInfosubTriggers| Constructor and Description |
|---|
AfterWatermarkEarlyAndLate(Trigger.OnceTrigger earlyTrigger,
Trigger.OnceTrigger lateTrigger) |
| Modifier and Type | Method and Description |
|---|---|
Trigger |
getContinuationTrigger()
Return a trigger to use after a
GroupByKey to preserve the
intention of this trigger. |
protected Trigger |
getContinuationTrigger(List<Trigger> continuationTriggers)
Return the
Trigger.getContinuationTrigger() of this Trigger. |
Instant |
getWatermarkThatGuaranteesFiring(BoundedWindow 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.
|
void |
onElement(Trigger.OnElementContext c)
Called every time an element is incorporated into a window.
|
void |
onFire(Trigger.TriggerContext context)
Adjusts the state of the trigger to be ready for the next pane.
|
void |
onMerge(Trigger.OnMergeContext c)
Called immediately after windows have been merged.
|
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() |
Trigger |
withEarlyFirings(Trigger.OnceTrigger earlyTrigger) |
Trigger |
withLateFirings(Trigger.OnceTrigger lateTrigger) |
clear, equals, hashCode, isCompatible, orFinally, prefetchOnElement, prefetchOnFire, prefetchOnMerge, prefetchShouldFire, subTriggerspublic AfterWatermarkEarlyAndLate(Trigger.OnceTrigger earlyTrigger, Trigger.OnceTrigger lateTrigger)
public Trigger withEarlyFirings(Trigger.OnceTrigger earlyTrigger)
public Trigger withLateFirings(Trigger.OnceTrigger lateTrigger)
public void onElement(Trigger.OnElementContext c) throws Exception
Triggerpublic void onMerge(Trigger.OnMergeContext c) 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(org.apache.beam.sdk.transforms.windowing.Trigger.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(org.apache.beam.sdk.transforms.windowing.Trigger.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.
public Trigger getContinuationTrigger()
TriggerGroupByKey to preserve the
intention of this trigger. Specifically, triggers that are time based
and intended to provide speculative results should continue providing
speculative results. Triggers that fire once (or multiple times) should
continue firing once (or multiple times).getContinuationTrigger in class Triggerprotected Trigger getContinuationTrigger(List<Trigger> continuationTriggers)
TriggerTrigger.getContinuationTrigger() of this Trigger. For convenience, this
is provided the continuation trigger of each of the sub-triggers.getContinuationTrigger in class Triggerpublic Instant getWatermarkThatGuaranteesFiring(BoundedWindow 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 Triggerpublic 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 TriggerExceptionpublic void onFire(Trigger.TriggerContext context) throws Exception
TriggerRepeatedly trigger will reset its inner trigger, since it has fired.
If the trigger is finished, it is the responsibility of the trigger itself to
record that fact via the context.