You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@toree.apache.org by "Gino Bustelo (JIRA)" <ji...@apache.org> on 2016/10/06 18:40:20 UTC

[jira] [Commented] (TOREE-346) Magics not working on latest master

    [ https://issues.apache.org/jira/browse/TOREE-346?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15552777#comment-15552777 ] 

Gino Bustelo commented on TOREE-346:
------------------------------------

note that for TOREE-347 we had to explicitly add the guava dependency... look at https://github.com/apache/incubator-toree/commit/f68ffdcdb8da4b2206af0b441f77c159b8866599

> Magics not working on latest master
> -----------------------------------
>
>                 Key: TOREE-346
>                 URL: https://issues.apache.org/jira/browse/TOREE-346
>             Project: TOREE
>          Issue Type: Bug
>            Reporter: Brian Burns
>              Labels: patch
>
> Magics are not working properly on the scala 2.11 / spark 2.0 master branch.  For example using the %%html magic will yield a result:
> Left(Map(text/html -> <b>foo</b>))
> The problem is in the scala IMain repl used in the 2.11 version of ScalaInterpreterSpecific read method.  IMain valueOfTerm is not working properly when given a variable name.  IMain eval is working however.  Below is a patch.
> commit 52d2ea2d69881327bd5c85b05d7a482b324f3769
> Author: Brian Burns <br...@gmail.com>
> Date:   Thu Oct 6 09:06:20 2016 -0400
>     use iMain.eval instead of iMain.valueOfTerm
> diff --git a/scala-interpreter/src/main/scala-2.11/org/apache/toree/kernel/interpreter/scala/ScalaInterpreterSpecific.scala b/scala-interpreter/src/main/scala-2.11/org/apache/toree/kernel/interpreter/scala/ScalaInterpreterSpecific.scala
> index 62f70a1..bd654e8 100644
> --- a/scala-interpreter/src/main/scala-2.11/org/apache/toree/kernel/interpreter/scala/ScalaInterpreterSpecific.scala
> +++ b/scala-interpreter/src/main/scala-2.11/org/apache/toree/kernel/interpreter/scala/ScalaInterpreterSpecific.scala
> @@ -258,12 +258,11 @@ trait ScalaInterpreterSpecific extends SettingsProducerLike { this: ScalaInterpr
>     */
>    override def read(variableName: String): Option[AnyRef] = {
>      require(iMain != null)
> -    val variable = iMain.valueOfTerm(variableName)
> -    if (variable == null || variable.isEmpty) None
> -    else variable match {
> -      case Some(v: AnyRef)  => Some(v)
> -      case Some(_)          => None // Don't support AnyVal yet
> -      case None             => None
> +
> +    iMain.eval(variableName) match {
> +      case null => None
> +      case str: String if str.isEmpty => None
> +      case res => Some(res)
>      }
>    }



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)