Search in sources :

Example 6 with SimpleTimerService

use of org.apache.flink.streaming.api.SimpleTimerService in project flink by apache.

the class LegacyKeyedCoProcessOperator method open.

@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);
}
Also used : SimpleTimerService(org.apache.flink.streaming.api.SimpleTimerService) VoidNamespace(org.apache.flink.runtime.state.VoidNamespace) TimerService(org.apache.flink.streaming.api.TimerService) SimpleTimerService(org.apache.flink.streaming.api.SimpleTimerService) InternalTimerService(org.apache.flink.streaming.api.operators.InternalTimerService)

Example 7 with SimpleTimerService

use of org.apache.flink.streaming.api.SimpleTimerService in project flink by apache.

the class AbstractStreamArrowPythonOverWindowAggregateFunctionOperator method open.

@Override
public void open() throws Exception {
    super.open();
    InternalTimerService<VoidNamespace> internalTimerService = getInternalTimerService("python-over-window-timers", VoidNamespaceSerializer.INSTANCE, this);
    timerService = new SimpleTimerService(internalTimerService);
    InternalTypeInfo<RowData> inputTypeInfo = InternalTypeInfo.of(inputType);
    ListTypeInfo<RowData> rowListTypeInfo = new ListTypeInfo<>(inputTypeInfo);
    MapStateDescriptor<Long, List<RowData>> inputStateDesc = new MapStateDescriptor<>("inputState", Types.LONG, rowListTypeInfo);
    ValueStateDescriptor<Long> lastTriggeringTsDescriptor = new ValueStateDescriptor<>("lastTriggeringTsState", Types.LONG);
    lastTriggeringTsState = getRuntimeContext().getState(lastTriggeringTsDescriptor);
    ValueStateDescriptor<Long> cleanupTsStateDescriptor = new ValueStateDescriptor<>("cleanupTsState", Types.LONG);
    cleanupTsState = getRuntimeContext().getState(cleanupTsStateDescriptor);
    inputState = getRuntimeContext().getMapState(inputStateDesc);
}
Also used : MapStateDescriptor(org.apache.flink.api.common.state.MapStateDescriptor) ValueStateDescriptor(org.apache.flink.api.common.state.ValueStateDescriptor) SimpleTimerService(org.apache.flink.streaming.api.SimpleTimerService) RowData(org.apache.flink.table.data.RowData) ListTypeInfo(org.apache.flink.api.java.typeutils.ListTypeInfo) VoidNamespace(org.apache.flink.runtime.state.VoidNamespace) List(java.util.List)

Example 8 with SimpleTimerService

use of org.apache.flink.streaming.api.SimpleTimerService in project flink by apache.

the class CoBroadcastWithKeyedOperator method open.

@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);
}
Also used : SimpleTimerService(org.apache.flink.streaming.api.SimpleTimerService) VoidNamespace(org.apache.flink.runtime.state.VoidNamespace) SimpleTimerService(org.apache.flink.streaming.api.SimpleTimerService) InternalTimerService(org.apache.flink.streaming.api.operators.InternalTimerService) TimerService(org.apache.flink.streaming.api.TimerService)

Example 9 with SimpleTimerService

use of org.apache.flink.streaming.api.SimpleTimerService in project flink by apache.

the class KeyedCoProcessOperator method open.

@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);
}
Also used : SimpleTimerService(org.apache.flink.streaming.api.SimpleTimerService) VoidNamespace(org.apache.flink.runtime.state.VoidNamespace) TimerService(org.apache.flink.streaming.api.TimerService) SimpleTimerService(org.apache.flink.streaming.api.SimpleTimerService) InternalTimerService(org.apache.flink.streaming.api.operators.InternalTimerService)

Aggregations

SimpleTimerService (org.apache.flink.streaming.api.SimpleTimerService)9 VoidNamespace (org.apache.flink.runtime.state.VoidNamespace)8 TimerService (org.apache.flink.streaming.api.TimerService)5 InternalTimerService (org.apache.flink.streaming.api.operators.InternalTimerService)3 List (java.util.List)1 MapStateDescriptor (org.apache.flink.api.common.state.MapStateDescriptor)1 ValueStateDescriptor (org.apache.flink.api.common.state.ValueStateDescriptor)1 ListTypeInfo (org.apache.flink.api.java.typeutils.ListTypeInfo)1 RowData (org.apache.flink.table.data.RowData)1 UpdatableRowData (org.apache.flink.table.data.UpdatableRowData)1