Skip to content

Commit de790fd

Browse files
committed
Upgrade scala to 2.11.12 and 2.12.6
1 parent aca65c6 commit de790fd

File tree

6 files changed

+31
-30
lines changed

6 files changed

+31
-30
lines changed

dev/deps/spark-deps-hadoop-2.6

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -172,10 +172,10 @@ parquet-jackson-1.10.0.jar
172172
protobuf-java-2.5.0.jar
173173
py4j-0.10.7.jar
174174
pyrolite-4.13.jar
175-
scala-compiler-2.11.8.jar
176-
scala-library-2.11.8.jar
175+
scala-compiler-2.11.12.jar
176+
scala-library-2.11.12.jar
177177
scala-parser-combinators_2.11-1.0.4.jar
178-
scala-reflect-2.11.8.jar
178+
scala-reflect-2.11.12.jar
179179
scala-xml_2.11-1.0.5.jar
180180
shapeless_2.11-2.3.2.jar
181181
slf4j-api-1.7.16.jar

dev/deps/spark-deps-hadoop-2.7

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -173,10 +173,10 @@ parquet-jackson-1.10.0.jar
173173
protobuf-java-2.5.0.jar
174174
py4j-0.10.7.jar
175175
pyrolite-4.13.jar
176-
scala-compiler-2.11.8.jar
177-
scala-library-2.11.8.jar
176+
scala-compiler-2.11.12.jar
177+
scala-library-2.11.12.jar
178178
scala-parser-combinators_2.11-1.0.4.jar
179-
scala-reflect-2.11.8.jar
179+
scala-reflect-2.11.12.jar
180180
scala-xml_2.11-1.0.5.jar
181181
shapeless_2.11-2.3.2.jar
182182
slf4j-api-1.7.16.jar

dev/deps/spark-deps-hadoop-3.1

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -192,10 +192,10 @@ protobuf-java-2.5.0.jar
192192
py4j-0.10.7.jar
193193
pyrolite-4.13.jar
194194
re2j-1.1.jar
195-
scala-compiler-2.11.8.jar
196-
scala-library-2.11.8.jar
195+
scala-compiler-2.11.12.jar
196+
scala-library-2.11.12.jar
197197
scala-parser-combinators_2.11-1.0.4.jar
198-
scala-reflect-2.11.8.jar
198+
scala-reflect-2.11.12.jar
199199
scala-xml_2.11-1.0.5.jar
200200
shapeless_2.11-2.3.2.jar
201201
slf4j-api-1.7.16.jar

pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@
155155
<commons.math3.version>3.4.1</commons.math3.version>
156156
<!-- managed up from 3.2.1 for SPARK-11652 -->
157157
<commons.collections.version>3.2.2</commons.collections.version>
158-
<scala.version>2.11.8</scala.version>
158+
<scala.version>2.11.12</scala.version>
159159
<scala.binary.version>2.11</scala.binary.version>
160160
<codehaus.jackson.version>1.9.13</codehaus.jackson.version>
161161
<fasterxml.jackson.version>2.6.7</fasterxml.jackson.version>
@@ -2748,7 +2748,7 @@
27482748
<profile>
27492749
<id>scala-2.12</id>
27502750
<properties>
2751-
<scala.version>2.12.4</scala.version>
2751+
<scala.version>2.12.6</scala.version>
27522752
<scala.binary.version>2.12</scala.binary.version>
27532753
</properties>
27542754
<build>

repl/scala-2.11/src/main/scala/org/apache/spark/repl/SparkILoop.scala

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class SparkILoop(in0: Option[BufferedReader], out: JPrintWriter)
3636
def this() = this(None, new JPrintWriter(Console.out, true))
3737

3838
override def createInterpreter(): Unit = {
39-
intp = new SparkILoopInterpreter(settings, out)
39+
intp = new SparkILoopInterpreter(settings, out, initializeSpark)
4040
}
4141

4242
val initializationCommands: Seq[String] = Seq(
@@ -73,12 +73,9 @@ class SparkILoop(in0: Option[BufferedReader], out: JPrintWriter)
7373
"import org.apache.spark.sql.functions._"
7474
)
7575

76-
def initializeSpark() {
77-
intp.beQuietDuring {
78-
savingReplayStack { // remove the commands from session history.
79-
initializationCommands.foreach(processLine)
80-
}
81-
}
76+
def initializeSpark(): Unit = savingReplayStack {
77+
// `savingReplayStack` removes the commands from session history.
78+
initializationCommands.foreach(intp quietRun _)
8279
}
8380

8481
/** Print a welcome message */
@@ -101,16 +98,6 @@ class SparkILoop(in0: Option[BufferedReader], out: JPrintWriter)
10198
/** Available commands */
10299
override def commands: List[LoopCommand] = standardCommands
103100

104-
/**
105-
* We override `loadFiles` because we need to initialize Spark *before* the REPL
106-
* sees any files, so that the Spark context is visible in those files. This is a bit of a
107-
* hack, but there isn't another hook available to us at this point.
108-
*/
109-
override def loadFiles(settings: Settings): Unit = {
110-
initializeSpark()
111-
super.loadFiles(settings)
112-
}
113-
114101
override def resetCommand(line: String): Unit = {
115102
super.resetCommand(line)
116103
initializeSpark()

repl/scala-2.11/src/main/scala/org/apache/spark/repl/SparkILoopInterpreter.scala

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,22 @@ import scala.collection.mutable
2121
import scala.tools.nsc.Settings
2222
import scala.tools.nsc.interpreter._
2323

24-
class SparkILoopInterpreter(settings: Settings, out: JPrintWriter) extends IMain(settings, out) {
25-
self =>
24+
class SparkILoopInterpreter(settings: Settings, out: JPrintWriter, initializeSpark: () => Unit)
25+
extends IMain(settings, out) { self =>
26+
27+
/**
28+
* We override `initializeSynchronous` to initialize Spark *after* `intp` is properly initialized
29+
* and *before* the REPL sees any files in the private `loadInitFiles` functions, so that
30+
* the Spark context is visible in those files.
31+
*
32+
* This is a bit of a hack, but there isn't another hook available to us at this point.
33+
*
34+
* See the discussion in Scala community https://github.com/scala/bug/issues/10913 for detail.
35+
*/
36+
override def initializeSynchronous(): Unit = {
37+
super.initializeSynchronous()
38+
initializeSpark()
39+
}
2640

2741
override lazy val memberHandlers = new {
2842
val intp: self.type = self

0 commit comments

Comments
 (0)