You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@toree.apache.org by lb...@apache.org on 2016/04/01 23:24:55 UTC
[2/2] incubator-toree git commit: Rebinding defs for sc ans sqlcontext
Rebinding defs for sc ans sqlcontext
Project: http://git-wip-us.apache.org/repos/asf/incubator-toree/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-toree/commit/781b1e59
Tree: http://git-wip-us.apache.org/repos/asf/incubator-toree/tree/781b1e59
Diff: http://git-wip-us.apache.org/repos/asf/incubator-toree/diff/781b1e59
Branch: refs/heads/master
Commit: 781b1e59293dcadb75bc9698137e19bbc5708997
Parents: 3adc189
Author: Gino Bustelo <lb...@apache.org>
Authored: Fri Apr 1 14:40:53 2016 -0500
Committer: Gino Bustelo <lb...@apache.org>
Committed: Fri Apr 1 14:40:53 2016 -0500
----------------------------------------------------------------------
.../kernel/interpreter/scala/ScalaInterpreter.scala | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/781b1e59/scala-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/scala/ScalaInterpreter.scala
----------------------------------------------------------------------
diff --git a/scala-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/scala/ScalaInterpreter.scala b/scala-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/scala/ScalaInterpreter.scala
index 69058b4..488b054 100644
--- a/scala-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/scala/ScalaInterpreter.scala
+++ b/scala-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/scala/ScalaInterpreter.scala
@@ -156,6 +156,12 @@ class ScalaInterpreter(private val config:Config = ConfigFactory.load) extends I
logger.debug(s"Ignoring rebinding of $termName")
}
})
+
+ /*
+ * Need to rebind the defs for sc and sqlContext
+ */
+ bindSparkContext()
+ bindSqlContext()
}
protected def reinitializeSymbols(): Unit = {
@@ -204,8 +210,8 @@ class ScalaInterpreter(private val config:Config = ConfigFactory.load) extends I
override def init(kernel: KernelLike): Interpreter = {
bindKernelVariable(kernel)
- bindSparkContext(kernel.sparkContext)
- bindSqlContext(kernel.sqlContext)
+ bindSparkContext()
+ bindSqlContext()
this
}
@@ -514,7 +520,7 @@ class ScalaInterpreter(private val config:Config = ConfigFactory.load) extends I
sparkIMain.beQuietDuring[T](body)
}
- def bindSparkContext(sparkContext: SparkContext) = {
+ def bindSparkContext() = {
val bindName = "sc"
doQuietly {
@@ -540,7 +546,7 @@ class ScalaInterpreter(private val config:Config = ConfigFactory.load) extends I
}
}
- def bindSqlContext(sqlContext: SQLContext): Unit = {
+ def bindSqlContext(): Unit = {
val bindName = "sqlContext"
doQuietly {
@@ -549,7 +555,6 @@ class ScalaInterpreter(private val config:Config = ConfigFactory.load) extends I
logger.debug(s"Binding SQLContext into interpreter as $bindName")
interpret(s"""def ${bindName}: ${classOf[SQLContext].getName} = kernel.sqlContext""")
- sqlContext
}
}