T
- The type of the values that can be added to the list state.@PublicEvolving public class ReducingStateDescriptor<T> extends StateDescriptor<ReducingState<T>,T>
StateDescriptor
for ReducingState
. This can be used to create partitioned
reducing state using
RuntimeContext.getReducingState(ReducingStateDescriptor)
.defaultValue, name, serializer
Constructor and Description |
---|
ReducingStateDescriptor(String name,
ReduceFunction<T> reduceFunction,
Class<T> typeClass)
Creates a new
ReducingStateDescriptor with the given name, type, and default value. |
ReducingStateDescriptor(String name,
ReduceFunction<T> reduceFunction,
TypeInformation<T> typeInfo)
Creates a new
ReducingStateDescriptor with the given name and default value. |
ReducingStateDescriptor(String name,
ReduceFunction<T> reduceFunction,
TypeSerializer<T> typeSerializer)
Creates a new
ValueStateDescriptor with the given name and default value. |
Modifier and Type | Method and Description |
---|---|
ReducingState<T> |
bind(StateBackend stateBackend)
Creates a new
State on the given StateBackend . |
boolean |
equals(Object o) |
ReduceFunction<T> |
getReduceFunction()
Returns the reduce function to be used for the reducing state.
|
int |
hashCode() |
String |
toString() |
getDefaultValue, getName, getSerializer, initializeSerializerUnlessSet, isSerializerInitialized
public ReducingStateDescriptor(String name, ReduceFunction<T> reduceFunction, Class<T> typeClass)
ReducingStateDescriptor
with the given name, type, and default value.
If this constructor fails (because it is not possible to describe the type via a class),
consider using the ReducingStateDescriptor(String, ReduceFunction, TypeInformation)
constructor.
name
- The (unique) name for the state.reduceFunction
- The ReduceFunction
used to aggregate the state.typeClass
- The type of the values in the state.public ReducingStateDescriptor(String name, ReduceFunction<T> reduceFunction, TypeInformation<T> typeInfo)
ReducingStateDescriptor
with the given name and default value.name
- The (unique) name for the state.reduceFunction
- The ReduceFunction
used to aggregate the state.typeInfo
- The type of the values in the state.public ReducingStateDescriptor(String name, ReduceFunction<T> reduceFunction, TypeSerializer<T> typeSerializer)
ValueStateDescriptor
with the given name and default value.name
- The (unique) name for the state.reduceFunction
- The ReduceFunction
used to aggregate the state.typeSerializer
- The type serializer of the values in the state.public ReducingState<T> bind(StateBackend stateBackend) throws Exception
StateDescriptor
State
on the given StateBackend
.bind
in class StateDescriptor<ReducingState<T>,T>
stateBackend
- The StateBackend
on which to create the State
.Exception
public ReduceFunction<T> getReduceFunction()
public boolean equals(Object o)
equals
in class StateDescriptor<ReducingState<T>,T>
public int hashCode()
hashCode
in class StateDescriptor<ReducingState<T>,T>
public String toString()
toString
in class StateDescriptor<ReducingState<T>,T>
Copyright © 2014–2017 The Apache Software Foundation. All rights reserved.