Reputation: 181
I have a method:
def udf(func: RDD[Row] => RDD[Row]) = ...
and another method:
def udf(func: List[String] => List[String]) = ...
in Scala. And it gives me this:
Error:(...) double definition:
method udf:(func: List[String] => List[String])UDFOperator and
method udf:(func: org.apache.spark.rdd.RDD[Row] => org.apache.spark.rdd.RDD[Row])UDFOperator at ...
have same type after erasure: (func: Function1)UDFOperator
def udf(func: List[String] => List[String]) = {
^
Upvotes: 0
Views: 259
Reputation: 52701
The JVM doesn't support generics, so anything that Scala might need in order to resolve a runtime generic type check can't be done.
In your case, both methods are expecting Function1[_,_]
parameters, and the JVM can't tell the difference between them. You'll have to rename one of them.
Upvotes: 4