import org.apache.spark.api.java.JavaRDD
import org.apache.spark.rdd.RDD
import scala.reflect.ClassTag
class TestRDD[T: ClassTag](rdd: RDD[T]) extends JavaRDD(rdd)
This statement is accepted from the console. However at compile time the following error is thrown:
No ClassTag available for T
[error] class TestRDD[T: ClassTag](rdd: RDD[T]) extends JavaRDD(rdd)
[error] ^
[error] one error found
[error] (jobs/it:compileIncremental) Compilation failed
I think you want this:
class TestRDD[T](rdd: List[T])(implicit c: ClassTag[T]) extends JavaRDD(rdd)
use implicit
to auto implicit the ClassTag
of generic T.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With