public class ArtificialKeyedStateMapper<IN,OUT> extends RichMapFunction<IN,OUT> implements CheckpointedFunction
MapFunction
that allows specifying what states to maintain based on a
provided list of ArtificialStateBuilder
s.Constructor and Description |
---|
ArtificialKeyedStateMapper(MapFunction<IN,OUT> mapFunction,
ArtificialStateBuilder<IN> artificialStateBuilders) |
ArtificialKeyedStateMapper(MapFunction<IN,OUT> mapFunction,
List<ArtificialStateBuilder<IN>> artificialStateBuilders) |
Modifier and Type | Method and Description |
---|---|
void |
initializeState(FunctionInitializationContext context)
This method is called when the parallel function instance is created during distributed
execution.
|
OUT |
map(IN value)
The mapping method.
|
void |
snapshotState(FunctionSnapshotContext context)
This method is called when a snapshot for a checkpoint is requested.
|
close, getIterationRuntimeContext, getRuntimeContext, open, setRuntimeContext
public ArtificialKeyedStateMapper(MapFunction<IN,OUT> mapFunction, ArtificialStateBuilder<IN> artificialStateBuilders)
public ArtificialKeyedStateMapper(MapFunction<IN,OUT> mapFunction, List<ArtificialStateBuilder<IN>> artificialStateBuilders)
public OUT map(IN value) throws Exception
MapFunction
map
in interface MapFunction<IN,OUT>
map
in class RichMapFunction<IN,OUT>
value
- The input value.Exception
- This method may throw exceptions. Throwing an exception will cause the
operation to fail and may trigger recovery.public void snapshotState(FunctionSnapshotContext context) throws Exception
CheckpointedFunction
FunctionInitializationContext
when the Function was initialized, or offered now by FunctionSnapshotContext
itself.snapshotState
in interface CheckpointedFunction
context
- the context for drawing a snapshot of the operatorException
- Thrown, if state could not be created ot restored.public void initializeState(FunctionInitializationContext context) throws Exception
CheckpointedFunction
initializeState
in interface CheckpointedFunction
context
- the context for initializing the operatorException
- Thrown, if state could not be created ot restored.Copyright © 2014–2023 The Apache Software Foundation. All rights reserved.