One of my class has a TypeTag:
abstract class Tagged[+T](implicit ttg: TypeTag[T])
the TypeTag (in this case a private variable) has caused some problem as its not serializable. So try to declare it as @transient:
abstract class Tagged[+T](@transient implicit val ttg: TypeTag[T])
But this seemingly trivial change has caused a big problem, Scala compiler throws the following error:
Error:(16, 51) covariant type T occurs in invariant position in type => org.apache.spark.sql.catalyst.ScalaReflection.universe.TypeTag[T] of value ttg
abstract class Tagged[+T](@transient implicit val ttg: TypeTag[T] = null) extends Extractor[T] with Static {
^
What I did is just changing private variable to public. What should I do to eliminate such error?