org.apache.flink.streaming.api.operators.TimestampedCollector Java Examples
The following examples show how to use
org.apache.flink.streaming.api.operators.TimestampedCollector.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CepOperator.java From flink with Apache License 2.0 | 6 votes |
@Override public void open() throws Exception { super.open(); timerService = getInternalTimerService( "watermark-callbacks", VoidNamespaceSerializer.INSTANCE, this); nfa = nfaFactory.createNFA(); nfa.open(cepRuntimeContext, new Configuration()); context = new ContextFunctionImpl(); collector = new TimestampedCollector<>(output); cepTimerService = new TimerServiceImpl(); // metrics this.numLateRecordsDropped = metrics.counter(LATE_ELEMENTS_DROPPED_METRIC_NAME); }
Example #2
Source File: TemporalRowTimeJoinOperator.java From flink with Apache License 2.0 | 6 votes |
@Override public void open() throws Exception { joinCondition = generatedJoinCondition.newInstance(getRuntimeContext().getUserCodeClassLoader()); joinCondition.setRuntimeContext(getRuntimeContext()); joinCondition.open(new Configuration()); nextLeftIndex = getRuntimeContext().getState( new ValueStateDescriptor<>(NEXT_LEFT_INDEX_STATE_NAME, Types.LONG)); leftState = getRuntimeContext().getMapState( new MapStateDescriptor<>(LEFT_STATE_NAME, Types.LONG, leftType)); rightState = getRuntimeContext().getMapState( new MapStateDescriptor<>(RIGHT_STATE_NAME, Types.LONG, rightType)); registeredTimer = getRuntimeContext().getState( new ValueStateDescriptor<>(REGISTERED_TIMER_STATE_NAME, Types.LONG)); timerService = getInternalTimerService( TIMERS_STATE_NAME, VoidNamespaceSerializer.INSTANCE, this); collector = new TimestampedCollector<>(output); outRow = new JoinedRow(); outRow.setHeader(BaseRowUtil.ACCUMULATE_MSG); }
Example #3
Source File: AsyncWaitOperator.java From flink with Apache License 2.0 | 6 votes |
@Override public void setup(StreamTask<?, ?> containingTask, StreamConfig config, Output<StreamRecord<OUT>> output) { super.setup(containingTask, config, output); this.inStreamElementSerializer = new StreamElementSerializer<>( getOperatorConfig().<IN>getTypeSerializerIn1(getUserCodeClassloader())); switch (outputMode) { case ORDERED: queue = new OrderedStreamElementQueue<>(capacity); break; case UNORDERED: queue = new UnorderedStreamElementQueue<>(capacity); break; default: throw new IllegalStateException("Unknown async mode: " + outputMode + '.'); } this.timestampedCollector = new TimestampedCollector<>(output); }
Example #4
Source File: CoBroadcastWithKeyedOperator.java From flink with Apache License 2.0 | 6 votes |
@Override public void open() throws Exception { super.open(); InternalTimerService<VoidNamespace> internalTimerService = getInternalTimerService("user-timers", VoidNamespaceSerializer.INSTANCE, this); TimerService timerService = new SimpleTimerService(internalTimerService); collector = new TimestampedCollector<>(output); this.broadcastStates = new HashMap<>(broadcastStateDescriptors.size()); for (MapStateDescriptor<?, ?> descriptor: broadcastStateDescriptors) { broadcastStates.put(descriptor, getOperatorStateBackend().getBroadcastState(descriptor)); } rwContext = new ReadWriteContextImpl(getExecutionConfig(), getKeyedStateBackend(), userFunction, broadcastStates, timerService); rContext = new ReadOnlyContextImpl(getExecutionConfig(), userFunction, broadcastStates, timerService); onTimerContext = new OnTimerContextImpl(getExecutionConfig(), userFunction, broadcastStates, timerService); }
Example #5
Source File: CoBroadcastWithKeyedOperator.java From flink with Apache License 2.0 | 6 votes |
@Override public void open() throws Exception { super.open(); InternalTimerService<VoidNamespace> internalTimerService = getInternalTimerService("user-timers", VoidNamespaceSerializer.INSTANCE, this); TimerService timerService = new SimpleTimerService(internalTimerService); collector = new TimestampedCollector<>(output); this.broadcastStates = new HashMap<>(broadcastStateDescriptors.size()); for (MapStateDescriptor<?, ?> descriptor: broadcastStateDescriptors) { broadcastStates.put(descriptor, getOperatorStateBackend().getBroadcastState(descriptor)); } rwContext = new ReadWriteContextImpl(getExecutionConfig(), getKeyedStateBackend(), userFunction, broadcastStates, timerService); rContext = new ReadOnlyContextImpl(getExecutionConfig(), userFunction, broadcastStates, timerService); onTimerContext = new OnTimerContextImpl(getExecutionConfig(), userFunction, broadcastStates, timerService); }
Example #6
Source File: CoBroadcastWithKeyedOperator.java From Flink-CEPplus with Apache License 2.0 | 6 votes |
@Override public void open() throws Exception { super.open(); InternalTimerService<VoidNamespace> internalTimerService = getInternalTimerService("user-timers", VoidNamespaceSerializer.INSTANCE, this); TimerService timerService = new SimpleTimerService(internalTimerService); collector = new TimestampedCollector<>(output); this.broadcastStates = new HashMap<>(broadcastStateDescriptors.size()); for (MapStateDescriptor<?, ?> descriptor: broadcastStateDescriptors) { broadcastStates.put(descriptor, getOperatorStateBackend().getBroadcastState(descriptor)); } rwContext = new ReadWriteContextImpl(getExecutionConfig(), getKeyedStateBackend(), userFunction, broadcastStates, timerService); rContext = new ReadOnlyContextImpl(getExecutionConfig(), userFunction, broadcastStates, timerService); onTimerContext = new OnTimerContextImpl(getExecutionConfig(), userFunction, broadcastStates, timerService); }
Example #7
Source File: TemporalRowTimeJoinOperator.java From flink with Apache License 2.0 | 6 votes |
@Override public void open() throws Exception { joinCondition = generatedJoinCondition.newInstance(getRuntimeContext().getUserCodeClassLoader()); joinCondition.setRuntimeContext(getRuntimeContext()); joinCondition.open(new Configuration()); nextLeftIndex = getRuntimeContext().getState( new ValueStateDescriptor<>(NEXT_LEFT_INDEX_STATE_NAME, Types.LONG)); leftState = getRuntimeContext().getMapState( new MapStateDescriptor<>(LEFT_STATE_NAME, Types.LONG, leftType)); rightState = getRuntimeContext().getMapState( new MapStateDescriptor<>(RIGHT_STATE_NAME, Types.LONG, rightType)); registeredTimer = getRuntimeContext().getState( new ValueStateDescriptor<>(REGISTERED_TIMER_STATE_NAME, Types.LONG)); timerService = getInternalTimerService( TIMERS_STATE_NAME, VoidNamespaceSerializer.INSTANCE, this); collector = new TimestampedCollector<>(output); outRow = new JoinedRowData(); // all the output records should be INSERT only, // because current temporal join only supports INSERT only left stream outRow.setRowKind(RowKind.INSERT); }
Example #8
Source File: CepOperator.java From Flink-CEPplus with Apache License 2.0 | 5 votes |
@Override public void open() throws Exception { super.open(); timerService = getInternalTimerService( "watermark-callbacks", VoidNamespaceSerializer.INSTANCE, this); nfa = nfaFactory.createNFA(); nfa.open(cepRuntimeContext, new Configuration()); context = new ContextFunctionImpl(); collector = new TimestampedCollector<>(output); cepTimerService = new TimerServiceImpl(); }
Example #9
Source File: CoBroadcastWithNonKeyedOperator.java From Flink-CEPplus with Apache License 2.0 | 5 votes |
@Override public void open() throws Exception { super.open(); collector = new TimestampedCollector<>(output); this.broadcastStates = new HashMap<>(broadcastStateDescriptors.size()); for (MapStateDescriptor<?, ?> descriptor: broadcastStateDescriptors) { broadcastStates.put(descriptor, getOperatorStateBackend().getBroadcastState(descriptor)); } rwContext = new ReadWriteContextImpl(getExecutionConfig(), userFunction, broadcastStates, getProcessingTimeService()); rContext = new ReadOnlyContextImpl(getExecutionConfig(), userFunction, broadcastStates, getProcessingTimeService()); }
Example #10
Source File: KeyedCoProcessOperator.java From Flink-CEPplus with Apache License 2.0 | 5 votes |
@Override public void open() throws Exception { super.open(); collector = new TimestampedCollector<>(output); InternalTimerService<VoidNamespace> internalTimerService = getInternalTimerService("user-timers", VoidNamespaceSerializer.INSTANCE, this); TimerService timerService = new SimpleTimerService(internalTimerService); context = new ContextImpl<>(userFunction, timerService); onTimerContext = new OnTimerContextImpl<>(userFunction, timerService); }
Example #11
Source File: UnorderedStreamElementQueue.java From flink with Apache License 2.0 | 5 votes |
@Override public void emitCompletedElement(TimestampedCollector<OUT> output) { if (segments.isEmpty()) { return; } final Segment currentSegment = segments.getFirst(); numberOfEntries -= currentSegment.emitCompleted(output); // remove any segment if there are further segments, if not leave it as an optimization even if empty if (segments.size() > 1 && currentSegment.isEmpty()) { segments.pop(); } }
Example #12
Source File: QueueUtil.java From flink with Apache License 2.0 | 5 votes |
/** * Pops all completed elements from the head of this queue. * * @return Completed elements or empty list if none exists. */ static List<StreamElement> popCompleted(StreamElementQueue<Integer> queue) { final List<StreamElement> completed = new ArrayList<>(); TimestampedCollector<Integer> collector = new TimestampedCollector<>(new CollectorOutput<>(completed)); while (queue.hasCompletedElements()) { queue.emitCompletedElement(collector); } collector.close(); return completed; }
Example #13
Source File: CoProcessOperator.java From Flink-CEPplus with Apache License 2.0 | 5 votes |
@Override public void open() throws Exception { super.open(); collector = new TimestampedCollector<>(output); context = new ContextImpl(userFunction, getProcessingTimeService()); }
Example #14
Source File: IntervalJoinOperator.java From Flink-CEPplus with Apache License 2.0 | 5 votes |
@Override public void open() throws Exception { super.open(); collector = new TimestampedCollector<>(output); context = new ContextImpl(userFunction); internalTimerService = getInternalTimerService(CLEANUP_TIMER_NAME, StringSerializer.INSTANCE, this); }
Example #15
Source File: LegacyKeyedCoProcessOperator.java From flink with Apache License 2.0 | 5 votes |
@Override public void open() throws Exception { super.open(); collector = new TimestampedCollector<>(output); InternalTimerService<VoidNamespace> internalTimerService = getInternalTimerService("user-timers", VoidNamespaceSerializer.INSTANCE, this); TimerService timerService = new SimpleTimerService(internalTimerService); context = new ContextImpl<>(userFunction, timerService); onTimerContext = new OnTimerContextImpl<>(userFunction, timerService); }
Example #16
Source File: CepOperator.java From flink with Apache License 2.0 | 5 votes |
@Override public void open() throws Exception { super.open(); timerService = getInternalTimerService( "watermark-callbacks", VoidNamespaceSerializer.INSTANCE, this); nfa = nfaFactory.createNFA(); nfa.open(cepRuntimeContext, new Configuration()); context = new ContextFunctionImpl(); collector = new TimestampedCollector<>(output); cepTimerService = new TimerServiceImpl(); }
Example #17
Source File: CoProcessOperator.java From flink with Apache License 2.0 | 5 votes |
@Override public void open() throws Exception { super.open(); collector = new TimestampedCollector<>(output); context = new ContextImpl(userFunction, getProcessingTimeService()); }
Example #18
Source File: UnorderedStreamElementQueue.java From flink with Apache License 2.0 | 5 votes |
/** * Pops one completed elements into the given output. Because an input element may produce an arbitrary * number of output elements, there is no correlation between the size of the collection and the popped * elements. * * @return the number of popped input elements. */ int emitCompleted(TimestampedCollector<OUT> output) { final StreamElementQueueEntry<OUT> completedEntry = completedElements.poll(); if (completedEntry == null) { return 0; } completedEntry.emitResult(output); return 1; }
Example #19
Source File: CoBroadcastWithNonKeyedOperator.java From flink with Apache License 2.0 | 5 votes |
@Override public void open() throws Exception { super.open(); collector = new TimestampedCollector<>(output); this.broadcastStates = new HashMap<>(broadcastStateDescriptors.size()); for (MapStateDescriptor<?, ?> descriptor: broadcastStateDescriptors) { broadcastStates.put(descriptor, getOperatorStateBackend().getBroadcastState(descriptor)); } rwContext = new ReadWriteContextImpl(getExecutionConfig(), userFunction, broadcastStates, getProcessingTimeService()); rContext = new ReadOnlyContextImpl(getExecutionConfig(), userFunction, broadcastStates, getProcessingTimeService()); }
Example #20
Source File: KeyedCoProcessOperator.java From flink with Apache License 2.0 | 5 votes |
@Override public void open() throws Exception { super.open(); collector = new TimestampedCollector<>(output); InternalTimerService<VoidNamespace> internalTimerService = getInternalTimerService("user-timers", VoidNamespaceSerializer.INSTANCE, this); TimerService timerService = new SimpleTimerService(internalTimerService); context = new ContextImpl<>(userFunction, timerService); onTimerContext = new OnTimerContextImpl<>(userFunction, timerService); }
Example #21
Source File: IntervalJoinOperator.java From flink with Apache License 2.0 | 5 votes |
@Override public void open() throws Exception { super.open(); collector = new TimestampedCollector<>(output); context = new ContextImpl(userFunction); internalTimerService = getInternalTimerService(CLEANUP_TIMER_NAME, StringSerializer.INSTANCE, this); }
Example #22
Source File: IntervalJoinOperator.java From flink with Apache License 2.0 | 5 votes |
@Override public void open() throws Exception { super.open(); collector = new TimestampedCollector<>(output); context = new ContextImpl(userFunction); internalTimerService = getInternalTimerService(CLEANUP_TIMER_NAME, StringSerializer.INSTANCE, this); }
Example #23
Source File: LegacyKeyedCoProcessOperator.java From flink with Apache License 2.0 | 5 votes |
@Override public void open() throws Exception { super.open(); collector = new TimestampedCollector<>(output); InternalTimerService<VoidNamespace> internalTimerService = getInternalTimerService("user-timers", VoidNamespaceSerializer.INSTANCE, this); TimerService timerService = new SimpleTimerService(internalTimerService); context = new ContextImpl<>(userFunction, timerService); onTimerContext = new OnTimerContextImpl<>(userFunction, timerService); }
Example #24
Source File: Emitter.java From flink with Apache License 2.0 | 5 votes |
public Emitter( final Object checkpointLock, final Output<StreamRecord<OUT>> output, final StreamElementQueue streamElementQueue, final OperatorActions operatorActions) { this.checkpointLock = Preconditions.checkNotNull(checkpointLock, "checkpointLock"); this.output = Preconditions.checkNotNull(output, "output"); this.streamElementQueue = Preconditions.checkNotNull(streamElementQueue, "streamElementQueue"); this.operatorActions = Preconditions.checkNotNull(operatorActions, "operatorActions"); this.timestampedCollector = new TimestampedCollector<>(this.output); this.running = true; }
Example #25
Source File: KeyedCoProcessOperator.java From flink with Apache License 2.0 | 5 votes |
@Override public void open() throws Exception { super.open(); collector = new TimestampedCollector<>(output); InternalTimerService<VoidNamespace> internalTimerService = getInternalTimerService("user-timers", VoidNamespaceSerializer.INSTANCE, this); TimerService timerService = new SimpleTimerService(internalTimerService); context = new ContextImpl<>(userFunction, timerService); onTimerContext = new OnTimerContextImpl<>(userFunction, timerService); }
Example #26
Source File: CoBroadcastWithNonKeyedOperator.java From flink with Apache License 2.0 | 5 votes |
@Override public void open() throws Exception { super.open(); collector = new TimestampedCollector<>(output); this.broadcastStates = new HashMap<>(broadcastStateDescriptors.size()); for (MapStateDescriptor<?, ?> descriptor: broadcastStateDescriptors) { broadcastStates.put(descriptor, getOperatorStateBackend().getBroadcastState(descriptor)); } rwContext = new ReadWriteContextImpl(getExecutionConfig(), userFunction, broadcastStates, getProcessingTimeService()); rContext = new ReadOnlyContextImpl(getExecutionConfig(), userFunction, broadcastStates, getProcessingTimeService()); }
Example #27
Source File: CoProcessOperator.java From flink with Apache License 2.0 | 5 votes |
@Override public void open() throws Exception { super.open(); collector = new TimestampedCollector<>(output); context = new ContextImpl(userFunction, getProcessingTimeService()); }
Example #28
Source File: BaseTemporalSortOperator.java From flink with Apache License 2.0 | 5 votes |
@Override public void open() throws Exception { InternalTimerService<VoidNamespace> internalTimerService = getInternalTimerService("user-timers", VoidNamespaceSerializer.INSTANCE, this); timerService = new SimpleTimerService(internalTimerService); collector = new TimestampedCollector<>(output); }
Example #29
Source File: AbstractStreamingJoinOperator.java From flink with Apache License 2.0 | 5 votes |
@Override public void open() throws Exception { super.open(); JoinCondition condition = generatedJoinCondition.newInstance(getRuntimeContext().getUserCodeClassLoader()); condition.setRuntimeContext(getRuntimeContext()); condition.open(new Configuration()); this.joinCondition = new JoinConditionWithNullFilters(condition); this.collector = new TimestampedCollector<>(output); }
Example #30
Source File: TemporalProcessTimeJoinOperator.java From flink with Apache License 2.0 | 5 votes |
@Override public void open() throws Exception { this.joinCondition = generatedJoinCondition.newInstance(getRuntimeContext().getUserCodeClassLoader()); FunctionUtils.setFunctionRuntimeContext(joinCondition, getRuntimeContext()); FunctionUtils.openFunction(joinCondition, new Configuration()); ValueStateDescriptor<RowData> rightStateDesc = new ValueStateDescriptor<>("right", rightType); this.rightState = getRuntimeContext().getState(rightStateDesc); this.collector = new TimestampedCollector<>(output); this.outRow = new JoinedRowData(); // consider watermark from left stream only. super.processWatermark2(Watermark.MAX_WATERMARK); }