@Experimental(value=STATE) public class StateSpecs extends java.lang.Object
StateSpecs
.Modifier and Type | Method and Description |
---|---|
static <T> StateSpec<BagState<T>> |
bag()
|
static <T> StateSpec<BagState<T>> |
bag(Coder<T> elemCoder)
Identical to
bag() , but with an element coder explicitly supplied. |
static <InputT,AccumT,OutputT> |
combining(Coder<AccumT> accumCoder,
Combine.CombineFn<InputT,AccumT,OutputT> combineFn)
Identical to
#combining(CombineFn) , but with an accumulator coder explicitly supplied. |
static <InputT,AccumT,OutputT> |
combining(Coder<AccumT> accumCoder,
CombineWithContext.CombineFnWithContext<InputT,AccumT,OutputT> combineFn)
Identical to
#combining(CombineFnWithContext) , but with an accumulator coder explicitly
supplied. |
static <InputT,AccumT,OutputT> |
combining(Combine.CombineFn<InputT,AccumT,OutputT> combineFn)
Create a
StateSpec for a CombiningState which uses a Combine.CombineFn to
automatically merge multiple values of type InputT into a single resulting OutputT . |
static <InputT,AccumT,OutputT> |
combining(CombineWithContext.CombineFnWithContext<InputT,AccumT,OutputT> combineFn)
Create a
StateSpec for a CombiningState which uses a CombineWithContext.CombineFnWithContext to automatically merge multiple values of type InputT into a
single resulting OutputT . |
static <InputT,AccumT,OutputT> |
combiningFromInputInternal(Coder<InputT> inputCoder,
Combine.CombineFn<InputT,AccumT,OutputT> combineFn)
For internal use only; no backwards-compatibility guarantees.
|
static <InputT,AccumT,OutputT> |
convertToBagSpecInternal(StateSpec<CombiningState<InputT,AccumT,OutputT>> combiningSpec)
For internal use only; no backwards-compatibility guarantees.
|
static <K,V> StateSpec<MapState<K,V>> |
map()
|
static <K,V> StateSpec<MapState<K,V>> |
map(Coder<K> keyCoder,
Coder<V> valueCoder)
Identical to
map() , but with key and value coders explicitly supplied. |
static <T> StateSpec<SetState<T>> |
set()
|
static <T> StateSpec<SetState<T>> |
set(Coder<T> elemCoder)
Identical to
set() , but with an element coder explicitly supplied. |
static <T> StateSpec<ValueState<T>> |
value()
Create a
StateSpec for a single value of type T . |
static <T> StateSpec<ValueState<T>> |
value(Coder<T> valueCoder)
Identical to
value() , but with a coder explicitly supplied. |
static StateSpec<WatermarkHoldState> |
watermarkStateInternal(TimestampCombiner timestampCombiner)
For internal use only; no backwards-compatibility guarantees.
|
public static <T> StateSpec<ValueState<T>> value()
StateSpec
for a single value of type T
.
This method attempts to infer the accumulator coder automatically.
value(Coder)
public static <T> StateSpec<ValueState<T>> value(Coder<T> valueCoder)
value()
, but with a coder explicitly supplied.
If automatic coder inference fails, use this method.
public static <InputT,AccumT,OutputT> StateSpec<CombiningState<InputT,AccumT,OutputT>> combining(Combine.CombineFn<InputT,AccumT,OutputT> combineFn)
StateSpec
for a CombiningState
which uses a Combine.CombineFn
to
automatically merge multiple values of type InputT
into a single resulting OutputT
.
This method attempts to infer the accumulator coder automatically.
#combining(Coder, CombineFn)
public static <InputT,AccumT,OutputT> StateSpec<CombiningState<InputT,AccumT,OutputT>> combining(CombineWithContext.CombineFnWithContext<InputT,AccumT,OutputT> combineFn)
StateSpec
for a CombiningState
which uses a CombineWithContext.CombineFnWithContext
to automatically merge multiple values of type InputT
into a
single resulting OutputT
.
This method attempts to infer the accumulator coder automatically.
#combining(Coder, CombineFnWithContext)
public static <InputT,AccumT,OutputT> StateSpec<CombiningState<InputT,AccumT,OutputT>> combining(Coder<AccumT> accumCoder, Combine.CombineFn<InputT,AccumT,OutputT> combineFn)
#combining(CombineFn)
, but with an accumulator coder explicitly supplied.
If automatic coder inference fails, use this method.
public static <InputT,AccumT,OutputT> StateSpec<CombiningState<InputT,AccumT,OutputT>> combining(Coder<AccumT> accumCoder, CombineWithContext.CombineFnWithContext<InputT,AccumT,OutputT> combineFn)
#combining(CombineFnWithContext)
, but with an accumulator coder explicitly
supplied.
If automatic coder inference fails, use this method.
public static <T> StateSpec<BagState<T>> bag()
StateSpec
for a BagState
, optimized for adding values frequently
and occasionally retrieving all the values that have been added.
This method attempts to infer the element coder automatically.
bag(Coder)
public static <T> StateSpec<BagState<T>> bag(Coder<T> elemCoder)
bag()
, but with an element coder explicitly supplied.
If automatic coder inference fails, use this method.
public static <T> StateSpec<SetState<T>> set()
StateSpec
for a SetState
, optimized for checking membership.
This method attempts to infer the element coder automatically.
set(Coder)
public static <T> StateSpec<SetState<T>> set(Coder<T> elemCoder)
set()
, but with an element coder explicitly supplied.
If automatic coder inference fails, use this method.
public static <K,V> StateSpec<MapState<K,V>> map()
StateSpec
for a SetState
, optimized for key lookups and writes.
This method attempts to infer the key and value coders automatically.
map(Coder, Coder)
public static <K,V> StateSpec<MapState<K,V>> map(Coder<K> keyCoder, Coder<V> valueCoder)
map()
, but with key and value coders explicitly supplied.
If automatic coder inference fails, use this method.
@Internal public static <InputT,AccumT,OutputT> StateSpec<CombiningState<InputT,AccumT,OutputT>> combiningFromInputInternal(Coder<InputT> inputCoder, Combine.CombineFn<InputT,AccumT,OutputT> combineFn)
Create a state spec for values that use a Combine.CombineFn
to automatically merge multiple
InputT
s into a single OutputT
.
This determines the Coder<AccumT>
from the given Coder<InputT>
, and should
only be used to initialize static values.
@Internal public static StateSpec<WatermarkHoldState> watermarkStateInternal(TimestampCombiner timestampCombiner)
Create a state spec for a watermark hold.
@Internal public static <InputT,AccumT,OutputT> StateSpec<BagState<AccumT>> convertToBagSpecInternal(StateSpec<CombiningState<InputT,AccumT,OutputT>> combiningSpec)
Convert a combining state spec to a bag of accumulators.