Interface SequencedMultiSetState<T>
-
- Type Parameters:
T- The type of elements stored in the state.
- All Known Implementing Classes:
LinkedMultiSetState
@Internal public interface SequencedMultiSetState<T>This class represents an interface for managing an ordered multi-set state in Apache Flink. It provides methods to add, append, and remove elements while maintaining insertion order.The state supports two types of semantics for adding elements:
- Normal Set Semantics: Replaces an existing matching element with the new one.
- Multi-Set Semantics: Appends the new element, allowing duplicates.
Removal operations are supported with different result types, indicating the outcome of the removal process, such as whether all elements were removed, the last added element was removed, or no elements were removed.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classSequencedMultiSetState.StateChangeInfo<T>Represents a result of a state changing operation.static classSequencedMultiSetState.StateChangeTypeRemoval Result Type.static classSequencedMultiSetState.Strategy
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description SequencedMultiSetState.StateChangeInfo<T>add(T element, long timestamp)Add the given element using the normal (non-multi) set semantics: if a matching element exists already, replace it (the timestamp is updated).SequencedMultiSetState.StateChangeInfo<T>append(T element, long timestamp)Add the given element using the multi-set semantics, i.e. append.voidclear()Clear the state (in the current key context).voidclearCache()Clear caches.static SequencedMultiSetState<org.apache.flink.table.data.RowData>create(SequencedMultiSetStateContext parameters, org.apache.flink.api.common.functions.RuntimeContext ctx, String backendTypeIdentifier)booleanisEmpty()Tells whether any state exists (in the given key context).Iterator<org.apache.flink.api.java.tuple.Tuple2<T,Long>>iterator()Get iterator over all remaining elements and their timestamps, in order of insertion.voidloadCache()Load cache.SequencedMultiSetState.StateChangeInfo<T>remove(T element)Remove the given element.
-
-
-
Method Detail
-
add
SequencedMultiSetState.StateChangeInfo<T> add(T element, long timestamp) throws Exception
Add the given element using the normal (non-multi) set semantics: if a matching element exists already, replace it (the timestamp is updated).- Throws:
Exception
-
append
SequencedMultiSetState.StateChangeInfo<T> append(T element, long timestamp) throws Exception
Add the given element using the multi-set semantics, i.e. append.- Throws:
Exception
-
remove
SequencedMultiSetState.StateChangeInfo<T> remove(T element) throws Exception
Remove the given element. If there are multiple instances of the same element, remove the first one in insertion order.- Throws:
Exception
-
iterator
Iterator<org.apache.flink.api.java.tuple.Tuple2<T,Long>> iterator() throws Exception
Get iterator over all remaining elements and their timestamps, in order of insertion.- Throws:
Exception
-
isEmpty
boolean isEmpty() throws IOExceptionTells whether any state exists (in the given key context).- Throws:
IOException
-
clear
void clear()
Clear the state (in the current key context).
-
loadCache
void loadCache() throws IOExceptionLoad cache.- Throws:
IOException
-
clearCache
void clearCache()
Clear caches.
-
create
static SequencedMultiSetState<org.apache.flink.table.data.RowData> create(SequencedMultiSetStateContext parameters, org.apache.flink.api.common.functions.RuntimeContext ctx, String backendTypeIdentifier)
-
-