Thank you for you response! But this approach did not help. This one works: def check[T: ClassTag](rdd: List[T]) = rdd match { case rdd: List[Int] if classTag[T] == classTag[Int] => println("Int") case rdd: List[String] if classTag[T] == classTag[String] => println("String") case rdd: List[ChildTypeOne] if classTag[T] == classTag[ChildTypeOne] => println("ChildTypeOne") } }
This one doesn't (Both times I got 1st case): def check2[T: ClassTag](rdd: RDD[T]) = rdd match { case rdd: RDD[ChildTypeOne] if classTag[T] == classTag[ChildTypeOne] => println("ChildTypeOne") case rdd: RDD[ChildTypeTwo] if classTag[T] == classTag[ChildTypeTwo] => println("ChildTypeTwo") } I found this https://issues.apache.org/jira/browse/SPARK-1296 Does it mean that there is no way to solve this problem? Pavel -- View this message in context: http://apache-spark-user-list.1001560.n3.nabble.com/Pattern-type-is-incompatible-with-expected-type-tp25805p25819.html Sent from the Apache Spark User List mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscr...@spark.apache.org For additional commands, e-mail: user-h...@spark.apache.org