Class BatchExecutionKeyedStateBackend<K>
- java.lang.Object
-
- org.apache.flink.streaming.api.operators.sorted.state.BatchExecutionKeyedStateBackend<K>
-
- All Implemented Interfaces:
Closeable,AutoCloseable,org.apache.flink.runtime.state.CheckpointableKeyedStateBackend<K>,org.apache.flink.runtime.state.KeyedStateBackend<K>,org.apache.flink.runtime.state.KeyedStateFactory,org.apache.flink.runtime.state.PriorityQueueSetFactory,org.apache.flink.runtime.state.Snapshotable<org.apache.flink.runtime.state.SnapshotResult<org.apache.flink.runtime.state.KeyedStateHandle>>,org.apache.flink.util.Disposable
public class BatchExecutionKeyedStateBackend<K> extends Object implements org.apache.flink.runtime.state.CheckpointableKeyedStateBackend<K>
ACheckpointableKeyedStateBackendwhich keeps values for a single key at a time.IMPORTANT: Requires the incoming records to be sorted/grouped by the key. Used in a BATCH style execution.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.flink.runtime.state.KeyedStateBackend
org.apache.flink.runtime.state.KeyedStateBackend.KeySelectionListener<K extends Object>
-
-
Constructor Summary
Constructors Constructor Description BatchExecutionKeyedStateBackend(org.apache.flink.api.common.typeutils.TypeSerializer<K> keySerializer, org.apache.flink.runtime.state.KeyGroupRange keyGroupRange, org.apache.flink.api.common.ExecutionConfig executionConfig)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <N,S extends org.apache.flink.api.common.state.State,T>
voidapplyToAllKeys(N namespace, org.apache.flink.api.common.typeutils.TypeSerializer<N> namespaceSerializer, org.apache.flink.api.common.state.StateDescriptor<S,T> stateDescriptor, org.apache.flink.runtime.state.KeyedStateFunction<K,S> function)voidclose()<T extends org.apache.flink.runtime.state.heap.HeapPriorityQueueElement & org.apache.flink.runtime.state.PriorityComparable<? super T> & org.apache.flink.runtime.state.Keyed<?>>
org.apache.flink.runtime.state.KeyGroupedInternalPriorityQueue<T>create(String stateName, org.apache.flink.api.common.typeutils.TypeSerializer<T> byteOrderedElementSerializer)<N,SV,SEV,S extends org.apache.flink.api.common.state.State,IS extends S>
IScreateOrUpdateInternalState(org.apache.flink.api.common.typeutils.TypeSerializer<N> namespaceSerializer, org.apache.flink.api.common.state.StateDescriptor<S,SV> stateDesc, org.apache.flink.runtime.state.StateSnapshotTransformer.StateSnapshotTransformFactory<SEV> snapshotTransformFactory)booleanderegisterKeySelectionListener(org.apache.flink.runtime.state.KeyedStateBackend.KeySelectionListener<K> listener)voiddispose()KgetCurrentKey()org.apache.flink.runtime.state.KeyGroupRangegetKeyGroupRange()<N> Stream<K>getKeys(String state, N namespace)<N> Stream<org.apache.flink.api.java.tuple.Tuple2<K,N>>getKeysAndNamespaces(String state)org.apache.flink.api.common.typeutils.TypeSerializer<K>getKeySerializer()<N,S extends org.apache.flink.api.common.state.State,T>
SgetOrCreateKeyedState(org.apache.flink.api.common.typeutils.TypeSerializer<N> namespaceSerializer, org.apache.flink.api.common.state.StateDescriptor<S,T> stateDescriptor)<N,S extends org.apache.flink.api.common.state.State>
SgetPartitionedState(N namespace, org.apache.flink.api.common.typeutils.TypeSerializer<N> namespaceSerializer, org.apache.flink.api.common.state.StateDescriptor<S,?> stateDescriptor)voidregisterKeySelectionListener(org.apache.flink.runtime.state.KeyedStateBackend.KeySelectionListener<K> listener)org.apache.flink.runtime.state.SavepointResources<K>savepoint()voidsetCurrentKey(K newKey)RunnableFuture<org.apache.flink.runtime.state.SnapshotResult<org.apache.flink.runtime.state.KeyedStateHandle>>snapshot(long checkpointId, long timestamp, org.apache.flink.runtime.state.CheckpointStreamFactory streamFactory, org.apache.flink.runtime.checkpoint.CheckpointOptions checkpointOptions)-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.flink.runtime.state.KeyedStateBackend
isSafeToReuseKVState, isStateImmutableInStateBackend
-
-
-
-
Constructor Detail
-
BatchExecutionKeyedStateBackend
public BatchExecutionKeyedStateBackend(org.apache.flink.api.common.typeutils.TypeSerializer<K> keySerializer, org.apache.flink.runtime.state.KeyGroupRange keyGroupRange, org.apache.flink.api.common.ExecutionConfig executionConfig)
-
-
Method Detail
-
setCurrentKey
public void setCurrentKey(K newKey)
- Specified by:
setCurrentKeyin interfaceorg.apache.flink.runtime.state.KeyedStateBackend<K>
-
getCurrentKey
public K getCurrentKey()
- Specified by:
getCurrentKeyin interfaceorg.apache.flink.runtime.state.KeyedStateBackend<K>
-
getKeySerializer
public org.apache.flink.api.common.typeutils.TypeSerializer<K> getKeySerializer()
- Specified by:
getKeySerializerin interfaceorg.apache.flink.runtime.state.KeyedStateBackend<K>
-
applyToAllKeys
public <N,S extends org.apache.flink.api.common.state.State,T> void applyToAllKeys(N namespace, org.apache.flink.api.common.typeutils.TypeSerializer<N> namespaceSerializer, org.apache.flink.api.common.state.StateDescriptor<S,T> stateDescriptor, org.apache.flink.runtime.state.KeyedStateFunction<K,S> function)- Specified by:
applyToAllKeysin interfaceorg.apache.flink.runtime.state.KeyedStateBackend<K>
-
getKeys
public <N> Stream<K> getKeys(String state, N namespace)
- Specified by:
getKeysin interfaceorg.apache.flink.runtime.state.KeyedStateBackend<K>
-
getKeysAndNamespaces
public <N> Stream<org.apache.flink.api.java.tuple.Tuple2<K,N>> getKeysAndNamespaces(String state)
- Specified by:
getKeysAndNamespacesin interfaceorg.apache.flink.runtime.state.KeyedStateBackend<K>
-
getOrCreateKeyedState
public <N,S extends org.apache.flink.api.common.state.State,T> S getOrCreateKeyedState(org.apache.flink.api.common.typeutils.TypeSerializer<N> namespaceSerializer, org.apache.flink.api.common.state.StateDescriptor<S,T> stateDescriptor) throws Exception
-
getPartitionedState
public <N,S extends org.apache.flink.api.common.state.State> S getPartitionedState(N namespace, org.apache.flink.api.common.typeutils.TypeSerializer<N> namespaceSerializer, org.apache.flink.api.common.state.StateDescriptor<S,?> stateDescriptor) throws Exception
-
dispose
public void dispose()
- Specified by:
disposein interfaceorg.apache.flink.util.Disposable- Specified by:
disposein interfaceorg.apache.flink.runtime.state.KeyedStateBackend<K>
-
registerKeySelectionListener
public void registerKeySelectionListener(org.apache.flink.runtime.state.KeyedStateBackend.KeySelectionListener<K> listener)
- Specified by:
registerKeySelectionListenerin interfaceorg.apache.flink.runtime.state.KeyedStateBackend<K>
-
deregisterKeySelectionListener
public boolean deregisterKeySelectionListener(org.apache.flink.runtime.state.KeyedStateBackend.KeySelectionListener<K> listener)
- Specified by:
deregisterKeySelectionListenerin interfaceorg.apache.flink.runtime.state.KeyedStateBackend<K>
-
createOrUpdateInternalState
@Nonnull public <N,SV,SEV,S extends org.apache.flink.api.common.state.State,IS extends S> IS createOrUpdateInternalState(@Nonnull org.apache.flink.api.common.typeutils.TypeSerializer<N> namespaceSerializer, @Nonnull org.apache.flink.api.common.state.StateDescriptor<S,SV> stateDesc, @Nonnull org.apache.flink.runtime.state.StateSnapshotTransformer.StateSnapshotTransformFactory<SEV> snapshotTransformFactory) throws Exception
- Specified by:
createOrUpdateInternalStatein interfaceorg.apache.flink.runtime.state.KeyedStateFactory- Throws:
Exception
-
create
@Nonnull public <T extends org.apache.flink.runtime.state.heap.HeapPriorityQueueElement & org.apache.flink.runtime.state.PriorityComparable<? super T> & org.apache.flink.runtime.state.Keyed<?>> org.apache.flink.runtime.state.KeyGroupedInternalPriorityQueue<T> create(@Nonnull String stateName, @Nonnull org.apache.flink.api.common.typeutils.TypeSerializer<T> byteOrderedElementSerializer)
- Specified by:
createin interfaceorg.apache.flink.runtime.state.PriorityQueueSetFactory
-
getKeyGroupRange
public org.apache.flink.runtime.state.KeyGroupRange getKeyGroupRange()
- Specified by:
getKeyGroupRangein interfaceorg.apache.flink.runtime.state.CheckpointableKeyedStateBackend<K>
-
close
public void close() throws IOException- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-
snapshot
@Nonnull public RunnableFuture<org.apache.flink.runtime.state.SnapshotResult<org.apache.flink.runtime.state.KeyedStateHandle>> snapshot(long checkpointId, long timestamp, @Nonnull org.apache.flink.runtime.state.CheckpointStreamFactory streamFactory, @Nonnull org.apache.flink.runtime.checkpoint.CheckpointOptions checkpointOptions)
- Specified by:
snapshotin interfaceorg.apache.flink.runtime.state.Snapshotable<K>
-
-