[jira] [Commented] (SPARK-17103) Can not define class variable in repl
[ https://issues.apache.org/jira/browse/SPARK-17103?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15425070#comment-15425070 ] Shixiong Zhu commented on SPARK-17103: -- Right now a workaround is just importing classes in the class like {code} class Test {import java.io.File; val f=new File(".")} {code} > Can not define class variable in repl > - > > Key: SPARK-17103 > URL: https://issues.apache.org/jira/browse/SPARK-17103 > Project: Spark > Issue Type: Bug > Components: Spark Shell >Affects Versions: 2.0.0 >Reporter: Jeff Zhang > > I can not execute the following code in spark 2.0 repl, but it succeeds in > scala 2.11 repl > spark 2.0 repl > {code} > scala> import java.io.File > import java.io.File > scala> class Test {val f=new File(".")} > :11: error: not found: type File >class Test {val f=new File(".")} > {code} > scala 2.11 repl > {code} > scala> import java.io.File > import java.io.File > scala> class Test { val f=new File(".")} > defined class Test > {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332) - To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org For additional commands, e-mail: issues-h...@spark.apache.org
[jira] [Commented] (SPARK-17103) Can not define class variable in repl
[ https://issues.apache.org/jira/browse/SPARK-17103?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15425041#comment-15425041 ] Shixiong Zhu commented on SPARK-17103: -- It's similar to https://issues.scala-lang.org/browse/SI-9799 (SPARK-14146). Deleting this line https://github.com/scala/scala/blob/cf38f078ad3bda0127e741a18f66d2c02d77b05a/src/repl/scala/tools/nsc/interpreter/Imports.scala#L119 will fix this issue. > Can not define class variable in repl > - > > Key: SPARK-17103 > URL: https://issues.apache.org/jira/browse/SPARK-17103 > Project: Spark > Issue Type: Bug > Components: Spark Shell >Affects Versions: 2.0.0 >Reporter: Jeff Zhang > > I can not execute the following code in spark 2.0 repl, but it succeeds in > scala 2.11 repl > spark 2.0 repl > {code} > scala> import java.io.File > import java.io.File > scala> class Test {val f=new File(".")} > :11: error: not found: type File >class Test {val f=new File(".")} > {code} > scala 2.11 repl > {code} > scala> import java.io.File > import java.io.File > scala> class Test { val f=new File(".")} > defined class Test > {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332) - To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org For additional commands, e-mail: issues-h...@spark.apache.org
[jira] [Commented] (SPARK-17103) Can not define class variable in repl
[ https://issues.apache.org/jira/browse/SPARK-17103?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15424228#comment-15424228 ] Jakob Odersky commented on SPARK-17103: --- That's true, the spark repl is basically just a thin wrapper around the scala repl, with custom initialization and settings. One of the settings, "-Yrepl-class-based", has caused issues previously and seems to be the culprit here again (I can reproduce the issue by running a normal scala repl with -Yrepl-class-based{/code} enabled). There is one option that is set by spark and has caused previous issues > Can not define class variable in repl > - > > Key: SPARK-17103 > URL: https://issues.apache.org/jira/browse/SPARK-17103 > Project: Spark > Issue Type: Bug > Components: Spark Shell >Affects Versions: 2.0.0 >Reporter: Jeff Zhang > > I can not execute the following code in spark 2.0 repl, but it succeeds in > scala 2.11 repl > spark 2.0 repl > {code} > scala> import java.io.File > import java.io.File > scala> class Test {val f=new File(".")} > :11: error: not found: type File >class Test {val f=new File(".")} > {code} > scala 2.11 repl > {code} > scala> import java.io.File > import java.io.File > scala> class Test { val f=new File(".")} > defined class Test > {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332) - To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org For additional commands, e-mail: issues-h...@spark.apache.org
[jira] [Commented] (SPARK-17103) Can not define class variable in repl
[ https://issues.apache.org/jira/browse/SPARK-17103?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15424102#comment-15424102 ] Sean Owen commented on SPARK-17103: --- You're using Scala 2.11 with Spark right? I can reproduce it, and that's really strange. This works, FWIW: {code} scala> class Test { val f = new java.io.File(".") } defined class Test {code} I think the Scala 2.11 shell is now pretty much matching Scala's, so I'm surprised. I have no idea but CC [~zsxwing] or [~jodersky] for a thought. > Can not define class variable in repl > - > > Key: SPARK-17103 > URL: https://issues.apache.org/jira/browse/SPARK-17103 > Project: Spark > Issue Type: Bug > Components: Spark Shell >Affects Versions: 2.0.0 >Reporter: Jeff Zhang > > I can not execute the following code in spark 2.0 repl, but it succeeds in > scala 2.11 repl > spark 2.0 repl > {code} > scala> import java.io.File > import java.io.File > scala> class Test {val f=new File(".")} > :11: error: not found: type File >class Test {val f=new File(".")} > {code} > scala 2.11 repl > {code} > scala> import java.io.File > import java.io.File > scala> class Test { val f=new File(".")} > defined class Test > {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332) - To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org For additional commands, e-mail: issues-h...@spark.apache.org