Re: Parsing source JSON String as Scala Case Class

2016-08-05 Thread Jack Huang
Thanks Stephan. "lazy val" does the trick. On Thu, Aug 4, 2016 at 2:33 AM, Stephan Ewen wrote: > If the class has non-serializable members, you need to initialize them > "lazily" when the objects are already in the distributed execution (after > serializing / distributing them). > > Making a Sca

Re: Parsing source JSON String as Scala Case Class

2016-08-04 Thread Stephan Ewen
If the class has non-serializable members, you need to initialize them "lazily" when the objects are already in the distributed execution (after serializing / distributing them). Making a Scala 'val' a 'lazy val' often does the trick (at minimal performance cost). On Thu, Aug 4, 2016 at 3:56 AM,

Parsing source JSON String as Scala Case Class

2016-08-03 Thread Jack Huang
Hi all, I want to read a source of JSON String as Scala Case Class. I don't want to have to write a serde for every case class I have. The idea is: val events = env.addSource(new FlinkKafkaConsumer09[Event]("events", new JsonSerde(classOf[Event]), kafkaProp)) ​ I was implementing my own JsonSer