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)
For internal use only; no backwards compatibility guarantees
|
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)
For internal use only; no backwards compatibility guarantees
|
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 <KeyT> StateSpec<MapState<KeyT,java.lang.Boolean>> |
convertToMapSpecInternal(StateSpec<SetState<KeyT>> setStateSpec)
For internal use only; no backwards-compatibility guarantees.
|
static <KeyT,ValueT> |
convertToMultimapSpecInternal(StateSpec<MapState<KeyT,ValueT>> spec)
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 <K,V> StateSpec<MultimapState<K,V>> |
multimap()
Create a
StateSpec for a MultimapState , optimized for key lookups, key puts,
and clear. |
static <K,V> StateSpec<MultimapState<K,V>> |
multimap(Coder<K> keyCoder,
Coder<V> valueCoder)
Identical to
multimap() , but with key and value coders explicitly supplied. |
static <T> StateSpec<OrderedListState<T>> |
orderedList(Coder<T> elemCoder) |
static StateSpec<BagState<Row>> |
rowBag(Schema schema)
|
static StateSpec<MapState<Row,Row>> |
rowMap(Schema keySchema,
Schema valueSchema)
|
static StateSpec<MultimapState<Row,Row>> |
rowMultimap(Schema keySchema,
Schema valueSchema)
Create a
StateSpec for a MultimapState , optimized for key lookups, key puts,
and clear. |
static StateSpec<OrderedListState<Row>> |
rowOrderedList(Schema valueSchema) |
static StateSpec<SetState<Row>> |
rowSet(Schema schema)
|
static StateSpec<ValueState<Row>> |
rowValue(Schema schema)
Create a
StateSpec for a row value with the specified schema. |
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 value coder automatically.
If the value type has a schema registered, then the schema will be used to encode the values.
value(Coder)
public static StateSpec<ValueState<Row>> rowValue(Schema schema)
StateSpec
for a row value with the specified schema.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)
@Internal public static <InputT,AccumT,OutputT> StateSpec<CombiningState<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
.
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.
@Internal public static <InputT,AccumT,OutputT> StateSpec<CombiningState<InputT,AccumT,OutputT>> combining(Coder<AccumT> accumCoder, CombineWithContext.CombineFnWithContext<InputT,AccumT,OutputT> combineFn)
Identical to #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.
If the element type has a schema registered, then the schema will be used to encode the values.
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.
If the element type has a schema registered, then the schema will be used to encode the values.
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 MapState
, optimized for key lookups and writes.
This method attempts to infer the key and value coders automatically.
If the key and value types have schemas registered, then the schemas will be used to encode the elements.
map(Coder, Coder)
public static StateSpec<MapState<Row,Row>> rowMap(Schema keySchema, Schema valueSchema)
StateSpec
for a MapState
, optimized for key lookups and writes.
This method is for storing maps where both the keys and the values are rows with the specified schemas.
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.
public static <T> StateSpec<OrderedListState<T>> orderedList(Coder<T> elemCoder)
public static StateSpec<OrderedListState<Row>> rowOrderedList(Schema valueSchema)
public static <K,V> StateSpec<MultimapState<K,V>> multimap()
StateSpec
for a MultimapState
, optimized for key lookups, key puts,
and clear.
This method attempts to infer the key and value coders automatically.
If the key and value types have schemas registered, then the schemas will be used to encode the elements.
multimap(Coder, Coder)
public static StateSpec<MultimapState<Row,Row>> rowMultimap(Schema keySchema, Schema valueSchema)
StateSpec
for a MultimapState
, optimized for key lookups, key puts,
and clear.
This method is for storing multimaps where both the keys and the values are rows with the specified schemas.
multimap(Coder, Coder)
public static <K,V> StateSpec<MultimapState<K,V>> multimap(Coder<K> keyCoder, Coder<V> valueCoder)
multimap()
, 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.
@Internal public static <KeyT> StateSpec<MapState<KeyT,java.lang.Boolean>> convertToMapSpecInternal(StateSpec<SetState<KeyT>> setStateSpec)
Convert a set state spec to a map-state spec.
@Internal public static <KeyT,ValueT> StateSpec<MultimapState<KeyT,ValueT>> convertToMultimapSpecInternal(StateSpec<MapState<KeyT,ValueT>> spec)
Convert a set state spec to a map-state spec.