Details
-
Bug
-
Status: Resolved
-
Blocker
-
Resolution: Fixed
-
0.9.0
-
None
Description
NOTE: This issue was fixed in 1.0.1, but the fix was reverted in Spark 1.0.2 pending further testing. The final fix will be in Spark 1.1.0.
Define a class in the shell:
case class TestClass(a:String)
and an RDD
val data = sc.parallelize(Seq("a")).map(TestClass(_))
define a function on it and map over the RDD
def itemFunc(a:TestClass):TestClass = a data.map(itemFunc)
Error:
<console>:19: error: type mismatch; found : TestClass => TestClass required: TestClass => ? data.map(itemFunc)
Similarly with a mapPartitions:
def partitionFunc(a:Iterator[TestClass]):Iterator[TestClass] = a data.mapPartitions(partitionFunc)
<console>:19: error: type mismatch;
found : Iterator[TestClass] => Iterator[TestClass]
required: Iterator[TestClass] => Iterator[?]
Error occurred in an application involving default arguments.
data.mapPartitions(partitionFunc)
The behavior is the same whether in local mode or on a cluster.
This isn't specific to RDDs. A Scala collection in the Spark shell has the same problem.
scala> Seq(TestClass("foo")).map(itemFunc) <console>:15: error: type mismatch; found : TestClass => TestClass required: TestClass => ? Seq(TestClass("foo")).map(itemFunc) ^
When run in the Scala console (not the Spark shell) there are no type mismatch errors.
Attachments
Issue Links
- breaks
-
SPARK-2576 slave node throws NoClassDefFoundError $line11.$read$ when executing a Spark QL query on HDFS CSV file
- Resolved
- is duplicated by
-
SPARK-1836 REPL $outer type mismatch causes lookup() and equals() problems
- Resolved
-
SPARK-2330 Spark shell has weird scala semantics
- Resolved
- is related to
-
SPARK-15964 Assignment to RDD-typed val fails
- Resolved
- is superceded by
-
SPARK-5149 Type mismatch when defining classes in Spark REPL
- Resolved
- relates to
-
SPARK-2452 Multi-statement input to spark repl does not work
- Resolved
- links to