Hello Everyone, can anyone pls tell me how to pass a value to open method of RichMapFunction?
The scenario is I have 2 java classes: Class1.java and Class2.java
Class1.java calls the MapFunction in Class2.java
Class1.java has the following code
DataStream
Row rowData = csvStream.map(
new CsvRowWrapper());
Class2.java has the following code
public class CsvRowWrapper
extends RichMapFunction
Object, Row {
private static final long serialVersionUID = 1L;
private transient Counter counter;
@Override
public void open(Configuration config) {
// need to read the value passed from class1.java here
*
this.co*unter = // value
passed from class1.java
}
@Override
public Row map(Object value) {
this.counter.inc();
HashMap
String, Object tempMap = (HashMap
String, Object) value;
return Row._of_(tempMap.values().toArray());
}
}