Class WindowOperator.Context
java.lang.Object
org.apache.flink.streaming.runtime.operators.windowing.WindowOperator.Context
- All Implemented Interfaces:
Trigger.OnMergeContext,Trigger.TriggerContext
Context is a utility for handling Trigger invocations. It can be reused by
setting the key and window fields. No internal state must be kept in the
Context-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()voiddeleteEventTimeTimer(long time) Delete the event-time trigger for the given time.voiddeleteProcessingTimeTimer(long time) Delete the processing time trigger for the given time.longReturns the current processing time.longReturns the current watermark time.org.apache.flink.metrics.MetricGroupReturns the metric group for thisTrigger.<S extends org.apache.flink.api.common.state.State>
SgetPartitionedState(org.apache.flink.api.common.state.StateDescriptor<S, ?> stateDescriptor) Retrieves aStateobject that can be used to interact with fault-tolerant state that is scoped to the window and key of the current trigger invocation.<S extends org.apache.flink.api.common.state.MergingState<?,?>>
voidmergePartitionedState(org.apache.flink.api.common.state.StateDescriptor<S, ?> stateDescriptor) onElement(StreamRecord<IN> element) onEventTime(long time) voidonMerge(Collection<W> mergedWindows) onProcessingTime(long time) voidregisterEventTimeTimer(long time) Register an event-time callback.voidregisterProcessingTimeTimer(long time) Register a system time callback.toString()
-
Field Details
-
key
-
window
-
mergedWindows
-
-
Constructor Details
-
Context
-
-
Method Details
-
getMetricGroup
public org.apache.flink.metrics.MetricGroup getMetricGroup()Description copied from interface:Trigger.TriggerContextReturns the metric group for thisTrigger. This is the same metric group that would be returned fromRuntimeContext.getMetricGroup()in a user function.You must not call methods that create metric objects (such as
MetricGroup.counter(int)multiple times but instead call once and store the metric object in a field.- Specified by:
getMetricGroupin interfaceTrigger.TriggerContext
-
getCurrentWatermark
public long getCurrentWatermark()Description copied from interface:Trigger.TriggerContextReturns the current watermark time.- Specified by:
getCurrentWatermarkin interfaceTrigger.TriggerContext
-
getPartitionedState
public <S extends org.apache.flink.api.common.state.State> S getPartitionedState(org.apache.flink.api.common.state.StateDescriptor<S, ?> stateDescriptor) Description copied from interface:Trigger.TriggerContextRetrieves aStateobject that can be used to interact with fault-tolerant state that is scoped to the window and key of the current trigger invocation.- Specified by:
getPartitionedStatein interfaceTrigger.TriggerContext- Type Parameters:
S- The type of the state.- Parameters:
stateDescriptor- The StateDescriptor that contains the name and type of the state that is being accessed.- Returns:
- The partitioned state object.
-
mergePartitionedState
public <S extends org.apache.flink.api.common.state.MergingState<?,?>> void mergePartitionedState(org.apache.flink.api.common.state.StateDescriptor<S, ?> stateDescriptor) - Specified by:
mergePartitionedStatein interfaceTrigger.OnMergeContext
-
getCurrentProcessingTime
public long getCurrentProcessingTime()Description copied from interface:Trigger.TriggerContextReturns the current processing time.- Specified by:
getCurrentProcessingTimein interfaceTrigger.TriggerContext
-
registerProcessingTimeTimer
public void registerProcessingTimeTimer(long time) Description copied from interface:Trigger.TriggerContextRegister a system time callback. When the current system time passes the specified timeTrigger.onProcessingTime(long, Window, TriggerContext)is called with the time specified here.- Specified by:
registerProcessingTimeTimerin interfaceTrigger.TriggerContext- Parameters:
time- The time at which to invokeTrigger.onProcessingTime(long, Window, TriggerContext)
-
registerEventTimeTimer
public void registerEventTimeTimer(long time) Description copied from interface:Trigger.TriggerContextRegister an event-time callback. When the current watermark passes the specified timeTrigger.onEventTime(long, Window, TriggerContext)is called with the time specified here.- Specified by:
registerEventTimeTimerin interfaceTrigger.TriggerContext- Parameters:
time- The watermark at which to invokeTrigger.onEventTime(long, Window, TriggerContext)- See Also:
-
deleteProcessingTimeTimer
public void deleteProcessingTimeTimer(long time) Description copied from interface:Trigger.TriggerContextDelete the processing time trigger for the given time.- Specified by:
deleteProcessingTimeTimerin interfaceTrigger.TriggerContext
-
deleteEventTimeTimer
public void deleteEventTimeTimer(long time) Description copied from interface:Trigger.TriggerContextDelete the event-time trigger for the given time.- Specified by:
deleteEventTimeTimerin interfaceTrigger.TriggerContext
-
onElement
- Throws:
Exception
-
onProcessingTime
- Throws:
Exception
-
onEventTime
- Throws:
Exception
-
onMerge
- Throws:
Exception
-
clear
- Throws:
Exception
-
toString
-