spark-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Shay Seng <>
Subject Spark REPL produces error on a piece of scala code that works in pure Scala REPL
Date Fri, 11 Oct 2013 23:55:20 GMT
I seeing a funny situation where a piece of code executes in a pure Scala
REPL but not in a Spark-shell.
I'm using Scala 2.9.3 with Spark 0.8.0

In Spark I see:
class Animal() {
    def says():String = "???"

val amimal = new Animal
amimal: this.Animal = Animal@df27cd5

class Zoo[A <: Animal](thing: A) {
    def whoami()=thing.getClass
    def chat()=thing.says

val z = new Zoo[Animal](amimal)
<console>:16: error: type mismatch;
 found   : this.Animal
 required: this.Animal
       val z = new Zoo[Animal](amimal)

But if I run the exact code in the scala REPL:

val z = new Zoo[Animal](amimal)
z: Zoo[Animal] = Zoo@738ff53f

Both repl report using scala 2.9.3
Spark: "Using Scala version 2.9.3 (Java HotSpot(TM) 64-Bit Server VM, Java
Scala: "Welcome to Scala version 2.9.3 (Java HotSpot(TM) 64-Bit Server VM,
Java 1.7.0_40)."
Any ideas?


View raw message