K
- The type of the key.N
- The type of the namespace.IN
- The type of the value added to the state.ACC
- The type of the value stored in the state (the accumulator type).OUT
- The type of the value returned from the state.public class HeapAggregatingState<K,N,IN,ACC,OUT> extends AbstractHeapMergingState<K,N,IN,OUT,ACC,AggregatingState<IN,OUT>,AggregatingStateDescriptor<IN,ACC,OUT>> implements InternalAggregatingState<N,IN,OUT>
ReducingState
that is
snapshotted into files.currentNamespace, keySerializer, namespaceSerializer, stateDesc, stateTable
Constructor and Description |
---|
HeapAggregatingState(AggregatingStateDescriptor<IN,ACC,OUT> stateDesc,
StateTable<K,N,ACC> stateTable,
TypeSerializer<K> keySerializer,
TypeSerializer<N> namespaceSerializer)
Creates a new key/value state for the given hash map of key/value pairs.
|
Modifier and Type | Method and Description |
---|---|
void |
add(IN value)
Updates the operator state accessible by
AppendingState.get() by adding the given value
to the list of values. |
OUT |
get()
Returns the current value for the state.
|
protected ACC |
mergeState(ACC a,
ACC b) |
mergeNamespaces
clear, getSerializedValue, getSerializedValue, getStateTable, setCurrentNamespace
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
mergeNamespaces
getSerializedValue, setCurrentNamespace
public HeapAggregatingState(AggregatingStateDescriptor<IN,ACC,OUT> stateDesc, StateTable<K,N,ACC> stateTable, TypeSerializer<K> keySerializer, TypeSerializer<N> namespaceSerializer)
stateDesc
- The state identifier for the state. This contains name and can create a default state value.stateTable
- The state table to use in this kev/value state. May contain initial state.namespaceSerializer
- The serializer for the type that indicates the namespacepublic OUT get()
AppendingState
NOTE TO IMPLEMENTERS: if the state is empty, then this method
should return null
.
get
in interface AppendingState<IN,OUT>
null
if the state is empty.public void add(IN value) throws IOException
AppendingState
AppendingState.get()
by adding the given value
to the list of values. The next time AppendingState.get()
is called (for the same state
partition) the returned state will represent the updated list.add
in interface AppendingState<IN,OUT>
value
- The new value for the state.IOException
- Thrown if the system cannot access the state.protected ACC mergeState(ACC a, ACC b) throws Exception
mergeState
in class AbstractHeapMergingState<K,N,IN,OUT,ACC,AggregatingState<IN,OUT>,AggregatingStateDescriptor<IN,ACC,OUT>>
Exception
Copyright © 2014–2018 The Apache Software Foundation. All rights reserved.