serialization - Flink is not able to serialize scala classes / Task Not Serializable -


i have scala class having 2 fields vals flink saying doesn't have setters. task not serializable.

i tried setters using var says duplicate setter. vals public why asking setters. flink version 1.1.0

class impression(val map: map[string, string],val keyset:set[string]) 

my code:

  val preaggregate = stream .filter(impression => {     true })  .map(impression => {   val xmap = impression.map   val values = valfunction(xmap)   new impressionrecord(impression, values._1, values._2, values._3) }) 

exceptions:

**class impression not contain setter field map** 19:54:49.995 [main] info  o.a.f.a.java.typeutils.typeextractor - class impression not valid pojo type 19:54:49.997 [main] debug o.a.flink.api.scala.closurecleaner$ - accessedfields: map(class  -> set()) exception in thread "main" **org.apache.flink.api.common.invalidprogramexception: task not serializable at** org.apache.flink.api.scala.closurecleaner$.ensureserializable(closurecleaner.scala:172) @ ) caused by: java.io.notserializableexception: org.apache.flink.streaming.api.scala.datastream @ java.io.objectoutputstream.writeobject0(objectoutputstream.java:1183) @ java.io.objectoutputstream.defaultwritefields(objectoutputstream.java:1547) @ java.io.objectoutputstream.writeserialdata(objectoutputstream.java:1508) @ java.io.objectoutputstream.writeordinaryobject(objectoutputstream.java:1431) @ java.io.objectoutputstream.writeobject0(objectoutputstream.java:1177) @ java.io.objectoutputstream.defaultwritefields(objectoutputstream.java:1547) @ java.io.objectoutputstream.writeserialdata(objectoutputstream.java:1508) @ java.io.objectoutputstream.writeordinaryobject(objectoutputstream.java:1431) @ java.io.objectoutputstream.writeobject0(objectoutputstream.java:1177) @ java.io.objectoutputstream.writeobject(objectoutputstream.java:347) @ org.apache.flink.util.instantiationutil.serializeobject(instantiationutil.java:301) @ org.apache.flink.api.scala.closurecleaner$.ensureserializable(closurecleaner.scala:170) ... 18 more 

try not use fields of classes directly rather wrap inside method , go.


Comments

Popular posts from this blog

Spring Boot + JPA + Hibernate: Unable to locate persister -

go - Golang: panic: runtime error: invalid memory address or nil pointer dereference using bufio.Scanner -

c - double free or corruption (fasttop) -