question about DataStream serialization

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

question about DataStream serialization

Radu Tudoran

Hello,

 

I have the following scenario  

 

·         Reading a fixed set

DataStream<String> fixedset = env.readtextFile(…

·         Reading a continuous stream of data

DataStream<String> stream = ….

 

I would need that for each event read from the continuous stream to make some operations onit and on the fixedsettoghether

 

 

I have tried something like

 

List<>

 

Final myObject.referenceStaticSet = fixedset;

stream.map(new MapFunction<String, String>() {

                     @Override

                     public String map(String arg0) throws Exception {

                          

                           //for example:   final string2add = arg0;

                                                                //the goal of below function would be to add the string2add to the fixedset

                           myObject.referenceStaticSet = myObject.referenceStaticSet.flatMap(new FlatMapFunction<String, String>() {

                          

                                  @Override

                                  public void flatMap(String arg0, Collector<String> arg1)

                                                                                //for example adding to the fixed set also the string2add object:   arg1.collect(string2add);

                                                                                }

}

 

However,  I get an exception (Exception in thread "main" org.apache.flink.api.common.InvalidProgramException: ) that object is not serializable (Object MyClass$3@a71081 not serializable )

 

Looking into this I see that the DataStream<> is not serializable

 

What would be the solution to this issue?

 

As I said I would like that for each event from the continuous stream to use the initial fixed set, add the event to it and apply an operation.

Stephan was mentioning at some point some possibility to create a DataSet and launch a batch processing while operating in stream mode– in case this is possible, can you give me a reference for it, because it might be the good solution to  use in case I could treat the fixed set as a DataSet and just add/remove the incoming event to it and apply an operation

 

Regards,

 

 

 

Dr. Radu Tudoran

Research Engineer

IT R&D Division

 

cid:image007.jpg@01CD52EB.AD060EE0

HUAWEI TECHNOLOGIES Duesseldorf GmbH

European Research Center

Riesstrasse 25, 80992 München

 

E-mail: [hidden email]

Mobile: +49 15209084330

Telephone: +49 891588344173

 

HUAWEI TECHNOLOGIES Duesseldorf GmbH
Hansaallee 205, 40549 Düsseldorf, Germany,
www.huawei.com
Registered Office: Düsseldorf, Register Court Düsseldorf, HRB 56063,
Managing Director: Jingwen TAO, Wanzhou MENG, Lifang CHEN
Sitz der Gesellschaft: Düsseldorf, Amtsgericht Düsseldorf, HRB 56063,
Geschäftsführer: Jingwen TAO, Wanzhou MENG, Lifang CHEN

This e-mail and its attachments contain confidential information from HUAWEI, which is intended only for the person or entity whose address is listed above. Any use of the information contained herein in any way (including, but not limited to, total or partial disclosure, reproduction, or dissemination) by persons other than the intended recipient(s) is prohibited. If you receive this e-mail in error, please notify the sender by phone or email immediately and delete it!