IN
- Type of the input elementsKEY
- Type of the key on which the input stream is keyedOUT
- Type of the output elementspublic abstract class AbstractKeyedCEPPatternOperator<IN,KEY,OUT,F extends Function> extends AbstractUdfStreamOperator<OUT,F> implements OneInputStreamOperator<IN,OUT>, Triggerable<KEY,VoidNamespace>
NFA
and a priority queue to buffer out of order elements. Both data structures are
stored using the managed keyed state. Additionally, the set of all seen keys is kept as part of the
operator state. This is necessary to trigger the execution for all keys upon receiving a new
watermark.AbstractStreamOperator.CountingOutput
Modifier and Type | Field and Description |
---|---|
protected AfterMatchSkipStrategy |
afterMatchSkipStrategy |
userFunction
chainingStrategy, config, latencyStats, LOG, metrics, output, timeServiceManager
Constructor and Description |
---|
AbstractKeyedCEPPatternOperator(TypeSerializer<IN> inputSerializer,
boolean isProcessingTime,
NFACompiler.NFAFactory<IN> nfaFactory,
EventComparator<IN> comparator,
AfterMatchSkipStrategy afterMatchSkipStrategy,
F function) |
Modifier and Type | Method and Description |
---|---|
int |
getPQSize(KEY key) |
boolean |
hasNonEmptyNFA(KEY key) |
boolean |
hasNonEmptyPQ(KEY key) |
void |
initializeState(StateInitializationContext context)
Stream operators with state which can be restored need to override this hook method.
|
void |
onEventTime(InternalTimer<KEY,VoidNamespace> timer)
Invoked when an event-time timer fires.
|
void |
onProcessingTime(InternalTimer<KEY,VoidNamespace> timer)
Invoked when a processing-time timer fires.
|
void |
open()
This method is called immediately before any elements are processed, it should contain the
operator's initialization logic, e.g.
|
void |
processElement(StreamRecord<IN> element)
Processes one element that arrived at this operator.
|
protected abstract void |
processMatchedSequences(Iterable<Map<String,List<IN>>> matchingSequences,
long timestamp) |
protected void |
processTimedOutSequences(Iterable<Tuple2<Map<String,List<IN>>,Long>> timedOutSequences,
long timestamp) |
close, dispose, getUserFunction, getUserFunctionParameters, notifyCheckpointComplete, setOutputType, setup, snapshotState
getChainingStrategy, getContainingTask, getCurrentKey, getExecutionConfig, getInternalTimerService, getKeyedStateBackend, getKeyedStateStore, getMetricGroup, getOperatorConfig, getOperatorID, getOperatorName, getOperatorStateBackend, getOrCreateKeyedState, getPartitionedState, getPartitionedState, getProcessingTimeService, getRuntimeContext, getUserCodeClassloader, initializeState, numEventTimeTimers, numProcessingTimeTimers, processLatencyMarker, processLatencyMarker1, processLatencyMarker2, processWatermark, processWatermark1, processWatermark2, reportOrForwardLatencyMarker, setChainingStrategy, setCurrentKey, setKeyContextElement1, setKeyContextElement2, snapshotState
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
processLatencyMarker, processWatermark
close, dispose, getChainingStrategy, getMetricGroup, getOperatorID, initializeState, setChainingStrategy, setKeyContextElement1, setKeyContextElement2, setup, snapshotState
notifyCheckpointComplete
getCurrentKey, setCurrentKey
protected final AfterMatchSkipStrategy afterMatchSkipStrategy
public AbstractKeyedCEPPatternOperator(TypeSerializer<IN> inputSerializer, boolean isProcessingTime, NFACompiler.NFAFactory<IN> nfaFactory, EventComparator<IN> comparator, AfterMatchSkipStrategy afterMatchSkipStrategy, F function)
public void initializeState(StateInitializationContext context) throws Exception
AbstractStreamOperator
initializeState
in class AbstractUdfStreamOperator<OUT,F extends Function>
context
- context that allows to register different states.Exception
public void open() throws Exception
AbstractStreamOperator
The default implementation does nothing.
open
in interface StreamOperator<OUT>
open
in class AbstractUdfStreamOperator<OUT,F extends Function>
Exception
- An exception in this method causes the operator to fail.public void processElement(StreamRecord<IN> element) throws Exception
OneInputStreamOperator
processElement
in interface OneInputStreamOperator<IN,OUT>
Exception
public void onEventTime(InternalTimer<KEY,VoidNamespace> timer) throws Exception
Triggerable
onEventTime
in interface Triggerable<KEY,VoidNamespace>
Exception
public void onProcessingTime(InternalTimer<KEY,VoidNamespace> timer) throws Exception
Triggerable
onProcessingTime
in interface Triggerable<KEY,VoidNamespace>
Exception
protected abstract void processMatchedSequences(Iterable<Map<String,List<IN>>> matchingSequences, long timestamp) throws Exception
Exception
protected void processTimedOutSequences(Iterable<Tuple2<Map<String,List<IN>>,Long>> timedOutSequences, long timestamp) throws Exception
Exception
@VisibleForTesting public boolean hasNonEmptyNFA(KEY key) throws IOException
IOException
@VisibleForTesting public boolean hasNonEmptyPQ(KEY key) throws Exception
Exception
@VisibleForTesting public int getPQSize(KEY key) throws Exception
Exception
Copyright © 2014–2019 The Apache Software Foundation. All rights reserved.