Search in sources :

Example 6 with InternalValueState

use of org.apache.flink.runtime.state.internal.InternalValueState in project flink by apache.

the class RowTimeWindowDeduplicateProcessor method open.

@Override
public void open(Context<Long> context) throws Exception {
    this.ctx = context;
    final LongSerializer namespaceSerializer = LongSerializer.INSTANCE;
    ValueStateDescriptor<RowData> valueStateDescriptor = new ValueStateDescriptor<>("window_deduplicate", inputSerializer);
    ValueState<RowData> state = ctx.getKeyedStateBackend().getOrCreateKeyedState(namespaceSerializer, valueStateDescriptor);
    this.windowTimerService = new WindowTimerServiceImpl(ctx.getTimerService(), shiftTimeZone);
    this.windowState = new WindowValueState<>((InternalValueState<RowData, Long, RowData>) state);
    this.windowBuffer = bufferFactory.create(ctx.getOperatorOwner(), ctx.getMemoryManager(), ctx.getMemorySize(), ctx.getRuntimeContext(), windowTimerService, ctx.getKeyedStateBackend(), windowState, true, shiftTimeZone);
    this.currentProgress = Long.MIN_VALUE;
}
Also used : ValueStateDescriptor(org.apache.flink.api.common.state.ValueStateDescriptor) RowData(org.apache.flink.table.data.RowData) InternalValueState(org.apache.flink.runtime.state.internal.InternalValueState) LongSerializer(org.apache.flink.api.common.typeutils.base.LongSerializer) WindowTimerServiceImpl(org.apache.flink.table.runtime.operators.window.slicing.WindowTimerServiceImpl)

Aggregations

InternalValueState (org.apache.flink.runtime.state.internal.InternalValueState)6 ValueStateDescriptor (org.apache.flink.api.common.state.ValueStateDescriptor)5 IOException (java.io.IOException)3 CancellationException (java.util.concurrent.CancellationException)3 BlockerCheckpointStreamFactory (org.apache.flink.runtime.util.BlockerCheckpointStreamFactory)3 RowData (org.apache.flink.table.data.RowData)3 StateMigrationException (org.apache.flink.util.StateMigrationException)3 Test (org.junit.Test)3 ExpectedException (org.junit.rules.ExpectedException)3 LongSerializer (org.apache.flink.api.common.typeutils.base.LongSerializer)2 GenericTypeInfo (org.apache.flink.api.java.typeutils.GenericTypeInfo)2 KryoSerializer (org.apache.flink.api.java.typeutils.runtime.kryo.KryoSerializer)2 PerWindowStateDataViewStore (org.apache.flink.table.runtime.dataview.PerWindowStateDataViewStore)2 WindowTimerServiceImpl (org.apache.flink.table.runtime.operators.window.slicing.WindowTimerServiceImpl)2 ArrayList (java.util.ArrayList)1 CompletableFuture (java.util.concurrent.CompletableFuture)1 ExecutorService (java.util.concurrent.ExecutorService)1 Future (java.util.concurrent.Future)1 RunnableFuture (java.util.concurrent.RunnableFuture)1 ValueState (org.apache.flink.api.common.state.ValueState)1