Initializing in "open(Configuration)" means that the ObjectMapper is
created only in the cluster once the MapFunction is started.
Otherwise it is created before (on the client) and Serialization-copied
into the cluster, together with the MapFunction.
If the second approach works well (i.e., the O
declare objectMapper out of map class.
final ObjectMapper objectMapper = new ObjectMapper();
source.map(str -> objectMapper.readValue(value, Request.class));
On Sat, Jul 23, 2016 at 12:28 AM, Yassin Marzouki
wrote:
> Thank you Stephan and Kim, that solved the problem.
> Just to make sure, is u
Thank you Stephan and Kim, that solved the problem.
Just to make sure, is using a MapFunction as in the following code any
different? i.e. does it initialize the objectMapper for every element in
the stream?
.map(new MapFunction() {
private ObjectMapper objectMapper = new ObjectMapper();
oops. stephan already answered.
sorry. T^T
On Sat, Jul 23, 2016 at 12:16 AM, Dong iL, Kim wrote:
> is open method signature right? or typo?
>
> void open(Configuration parameters) throws Exception;
>
> On Sat, Jul 23, 2016 at 12:09 AM, Stephan Ewen wrote:
>
>> I think you overrode the open meth
is open method signature right? or typo?
void open(Configuration parameters) throws Exception;
On Sat, Jul 23, 2016 at 12:09 AM, Stephan Ewen wrote:
> I think you overrode the open method with the wrong signature. The right
> signature would be "open(Configuration cfg) {...}". You probably over
I think you overrode the open method with the wrong signature. The right
signature would be "open(Configuration cfg) {...}". You probably overlooked
this because you missed the "@Override" annotation.
On Fri, Jul 22, 2016 at 4:49 PM, Yassin Marzouki
wrote:
> Hi everyone,
>
> I want to convert a
Hi everyone,
I want to convert a stream of json strings to POJOs using Jackson, so I did
the following:
.map(new RichMapFunction() {
private ObjectMapper objectMapper;
public void open() {
objectMapper = new ObjectMapper();
}
@Override
publi