IN
- The type of the values that are added to the state.ACC
- The type of the accumulator (intermediate aggregation state).OUT
- The type of the values that are returned from the state.@PublicEvolving public class AggregatingStateDescriptor<IN,ACC,OUT> extends StateDescriptor<AggregatingState<IN,OUT>,ACC>
AggregatingState
.
The type internally stored in the state is the type of the Accumulator
of the
AggregateFunction
.
StateDescriptor.Type
defaultValue, name, serializer
Constructor and Description |
---|
AggregatingStateDescriptor(String name,
AggregateFunction<IN,ACC,OUT> aggFunction,
Class<ACC> stateType)
Creates a new state descriptor with the given name, function, and type.
|
AggregatingStateDescriptor(String name,
AggregateFunction<IN,ACC,OUT> aggFunction,
TypeInformation<ACC> stateType)
Creates a new
ReducingStateDescriptor with the given name and default value. |
AggregatingStateDescriptor(String name,
AggregateFunction<IN,ACC,OUT> aggFunction,
TypeSerializer<ACC> typeSerializer)
Creates a new
ValueStateDescriptor with the given name and default value. |
Modifier and Type | Method and Description |
---|---|
AggregatingState<IN,OUT> |
bind(StateBinder stateBinder)
Creates a new
State on the given StateBinder . |
AggregateFunction<IN,ACC,OUT> |
getAggregateFunction()
Returns the aggregate function to be used for the state.
|
StateDescriptor.Type |
getType() |
equals, getDefaultValue, getName, getQueryableStateName, getSerializer, hashCode, initializeSerializerUnlessSet, isQueryable, isSerializerInitialized, setQueryable, toString
public AggregatingStateDescriptor(String name, AggregateFunction<IN,ACC,OUT> aggFunction, Class<ACC> stateType)
If this constructor fails (because it is not possible to describe the type via a class),
consider using the AggregatingStateDescriptor(String, AggregateFunction, TypeInformation)
constructor.
name
- The (unique) name for the state.aggFunction
- The AggregateFunction
used to aggregate the state.stateType
- The type of the accumulator. The accumulator is stored in the state.public AggregatingStateDescriptor(String name, AggregateFunction<IN,ACC,OUT> aggFunction, TypeInformation<ACC> stateType)
ReducingStateDescriptor
with the given name and default value.name
- The (unique) name for the state.aggFunction
- The AggregateFunction
used to aggregate the state.stateType
- The type of the accumulator. The accumulator is stored in the state.public AggregatingStateDescriptor(String name, AggregateFunction<IN,ACC,OUT> aggFunction, TypeSerializer<ACC> typeSerializer)
ValueStateDescriptor
with the given name and default value.name
- The (unique) name for the state.aggFunction
- The AggregateFunction
used to aggregate the state.typeSerializer
- The serializer for the accumulator. The accumulator is stored in the state.public AggregatingState<IN,OUT> bind(StateBinder stateBinder) throws Exception
StateDescriptor
State
on the given StateBinder
.bind
in class StateDescriptor<AggregatingState<IN,OUT>,ACC>
stateBinder
- The StateBackend
on which to create the State
.Exception
public AggregateFunction<IN,ACC,OUT> getAggregateFunction()
public StateDescriptor.Type getType()
getType
in class StateDescriptor<AggregatingState<IN,OUT>,ACC>
Copyright © 2014–2019 The Apache Software Foundation. All rights reserved.