You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@toree.apache.org by kevin-bates <gi...@git.apache.org> on 2017/03/22 16:19:48 UTC
[GitHub] incubator-toree pull request #104: TOREE-380: Allow interpreters to format o...
Github user kevin-bates commented on a diff in the pull request:
https://github.com/apache/incubator-toree/pull/104#discussion_r107460553
--- Diff: scala-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/scala/ScalaInterpreter.scala ---
@@ -18,37 +18,45 @@
package org.apache.toree.kernel.interpreter.scala
import java.io.ByteArrayOutputStream
-import java.net.{URL, URLClassLoader}
-import java.nio.charset.Charset
import java.util.concurrent.ExecutionException
import com.typesafe.config.{Config, ConfigFactory}
import org.apache.spark.SparkContext
-import org.apache.spark.sql.SparkSession
import org.apache.spark.repl.Main
+import org.apache.spark.sql.SparkSession
import org.apache.toree.interpreter._
-import org.apache.toree.kernel.api.{KernelLike, KernelOptions}
+import org.apache.toree.kernel.api.KernelLike
import org.apache.toree.utils.{MultiOutputStream, TaskManager}
import org.slf4j.LoggerFactory
import org.apache.toree.kernel.BuildInfo
import scala.annotation.tailrec
+import scala.collection.mutable
import scala.concurrent.{Await, Future}
import scala.language.reflectiveCalls
import scala.tools.nsc.Settings
import scala.tools.nsc.interpreter.{IR, OutputStream}
import scala.tools.nsc.util.ClassPath
-import scala.util.{Try => UtilTry}
+
+import org.apache.toree.kernel.protocol.v5.MIMEType
+import org.apache.toree.magic.MagicOutput
+import vegas.DSL.ExtendedUnitSpecBuilder
+import vegas.render.StaticHTMLRenderer
+
class ScalaInterpreter(private val config:Config = ConfigFactory.load) extends Interpreter with ScalaInterpreterSpecific {
+ import ScalaInterpreter._
+
+ private var kernel: KernelLike = _
+
protected val logger = LoggerFactory.getLogger(this.getClass.getName)
protected val _thisClassloader = this.getClass.getClassLoader
protected val lastResultOut = new ByteArrayOutputStream()
- protected val multiOutputStream = MultiOutputStream(List(Console.out, lastResultOut))
+ protected val multiOutputStream = lastResultOut
--- End diff --
At a minimum, this needs to remain a MultiOutputStream (of one item) else it will produce a compilation error in [here](https://github.com/apache/incubator-toree/blob/master/scala-interpreter/src/test/scala/integration/interpreter/scala/AddExternalJarMagicSpecForIntegration.scala#L41). Removal of Console.out is further discussed in #116.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---