Hello,
I have 2 questions regarding the RichMapFunction, starting from its use in
https://github.com/apache/incubator-flink/blob/master/flink-examples/flink-java-examples/src/main/java/org/apache/flink/examples/java/ml/LinearRegression.java
.
Q1: if we run this operator with 4 nodes, does its open(Configuration) method
execute once on each node ?
Q2: can we use fields (such as a counter) in the RichMapFunction class so that
they are not shared between computation nodes, but are shared for all tuples
that pass this transformation on a given computation node?
Something like:
dataset1.map(
new RichMapFunction<T1,T2>(){
private int k;
public void open(Configuration config){
...........
k = 0;
}
public T2 map(T1 tupin){
k++;
return new T2(....,k)
}
}
);
where T1,T2 stand for some tuple types or classes .
Thank you in advance!
Best regards,
Camelia