public interface StatefulFunction<I,O,S> extends RichFunction
Modifier and Type | Method and Description |
---|---|
O |
applyWithState(I in,
scala.Function2<I,scala.Option<S>,scala.Tuple2<O,scala.Option<S>>> fun) |
void |
open(Configuration c)
Initialization method for the function.
|
TypeSerializer<S> |
stateSerializer() |
close, getIterationRuntimeContext, getRuntimeContext, setRuntimeContext
TypeSerializer<S> stateSerializer()
O applyWithState(I in, scala.Function2<I,scala.Option<S>,scala.Tuple2<O,scala.Option<S>>> fun)
void open(Configuration c)
RichFunction
The configuration object passed to the function can be used for configuration and initialization. The configuration contains all parameters that were configured on the function in the program composition.
public class MyMapper extends FilterFunction<String> {
private String searchString;
public void open(Configuration parameters) {
this.searchString = parameters.getString("foo");
}
public boolean filter(String value) {
return value.equals(searchString);
}
}
By default, this method does nothing.
open
in interface RichFunction
c
- The configuration containing the parameters attached to the contract.Configuration
Copyright © 2014–2017 The Apache Software Foundation. All rights reserved.