flink-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Camelia-Elena Ciolac <camelia-elena.cio...@inria.fr>
Subject RichMapFunction related question
Date Tue, 04 Nov 2014 15:16:42 GMT
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 



Mime
View raw message