-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
loadFiles()
in ILoop
was removed in Scala 2.11.12 which breaks Apache Spark
#10913
Comments
Unfortunately, Alternatively, you can externalize the init commands and set the system property |
Thanks for the reply. I tried two of the ideas you pointed out without success.
class SparkILoop(in0: Option[BufferedReader], out: JPrintWriter)
extends ILoop(in0, out) {
...
override def createInterpreter(): Unit = {
intp = new SparkILoopInterpreter(settings, out, initializeSpark)
}
def initializeSpark() {
intp.beQuietDuring {
savingReplayStack { // remove the commands from session history.
initializationCommands.foreach(processLine)
}
}
}
...
} and class SparkILoopInterpreter(settings: Settings, out: JPrintWriter, sparkInitFun: () => Unit)
extends IMain(settings, out) {
self =>
override def initializeSynchronous(): Unit = {
super.initializeSynchronous()
sparkInitFun()
}
...
} this will hang forever. Can you elaborate more on the alternative option? Thanks. |
If you need I'll try to get involved between now and the weekend, it's been on my bucket list. |
FYI, the original Spark REPL runs |
@som-snytt are you saying calling |
@dbtsai Apologies, I ran out of time this weekend because of IKEA. I think I did mean to bind |
@som-snytt I got it working in apache/spark#21495 I have couple questions asked there, and would like to get your feedback. Thanks. |
@dbtsai That's fantabulous! I commented there. The upshot is, after deprecating it, because it wasn't used, I have to revive |
@dbtsai et al -- see https://issues.apache.org/jira/browse/SPARK-20395 and apache/spark#17982 . The internal change in question happened about 2.11.10 or so if it matters. Reenabling the hack is great I suppose but Spark was always using internal methods that weren't exposed. |
## What changes were proposed in this pull request? Scala is upgraded to `2.11.12` and `2.12.6`. We used `loadFIles()` in `ILoop` as a hook to initialize the Spark before REPL sees any files in Scala `2.11.8`. However, it was a hack, and it was not intended to be a public API, so it was removed in Scala `2.11.12`. From the discussion in Scala community, scala/bug#10913 , we can use `initializeSynchronous` to initialize Spark instead. This PR implements the Spark initialization there. However, in Scala `2.11.12`'s `ILoop.scala`, in function `def startup()`, the first thing it calls is `printWelcome()`. As a result, Scala will call `printWelcome()` and `splash` before calling `initializeSynchronous`. Thus, the Spark shell will allow users to type commends first, and then show the Spark UI URL. It's working, but it will change the Spark Shell interface as the following. ```scala ➜ apache-spark git:(scala-2.11.12) ✗ ./bin/spark-shell Setting default log level to "WARN". To adjust logging level use sc.setLogLevel(newLevel). For SparkR, use setLogLevel(newLevel). Welcome to ____ __ / __/__ ___ _____/ /__ _\ \/ _ \/ _ `/ __/ '_/ /___/ .__/\_,_/_/ /_/\_\ version 2.4.0-SNAPSHOT /_/ Using Scala version 2.11.12 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_161) Type in expressions to have them evaluated. Type :help for more information. scala> Spark context Web UI available at http://192.168.1.169:4040 Spark context available as 'sc' (master = local[*], app id = local-1528180279528). Spark session available as 'spark'. scala> ``` It seems there is no easy way to inject the Spark initialization code in the proper place as Scala doesn't provide a hook. Maybe som-snytt can comment on this. The following command is used to update the dep files. ```scala ./dev/test-dependencies.sh --replace-manifest ``` ## How was this patch tested? Existing tests Author: DB Tsai <[email protected]> Closes apache#21495 from dbtsai/scala-2.11.12.
should this ticket be closed now that apache/spark#21495 has gone through? |
Thank you all for helping on this! |
We're migrating to Scala 2.11.12 for JDK9+ support, and we found that
loadFIles()
inILoop
was removed in Scala 2.11.12.We use it as a hack to initialize the Spark before REPL sees any files.
https://github.com/apache/spark/blob/master/repl/scala-2.11/src/main/scala/org/apache/spark/repl/SparkILoop.scala#L109
Is it possible to provide a hook for this?
Thanks.
The text was updated successfully, but these errors were encountered: