[ 
https://issues.apache.org/jira/browse/TOREE-365?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Jakob Odersky updated TOREE-365:
--------------------------------
    Description: 
The scala interpreter currently only returns results for expressions. Import 
statements and declarations will not show up as results in a notebook (although 
they are evaluated internally).

This behaviour is related to the 
[ScalaInterpreter#truncateResult|(https://github.com/apache/incubator-toree/blob/master/scala-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/scala/ScalaInterpreter.scala#L165-L187]
 function. This function runs the result string of a REPL line through a regex, 
in order to remove the "resX:" part. The function returns the empty string in 
case the line does not start with "resX:", therefore returning an empty string 
for import statements and other declarations. This can have several subtle side 
effects, such as TOREE-340, or a toree client never completing the "onResult" 
callback.

A quick fix to this issue is to return the result string as-is if it does not 
start with "resX".

  was:
The scala interpreter currently only returns results for expressions. Import 
statements and declarations will not show up as results in a notebook (although 
they are evaluated internally).

This behaviour is related to the 
[ScalaInterpreter#truncateResult|(https://github.com/apache/incubator-toree/blob/master/scala-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/scala/ScalaInterpreter.scala#L165-L187]
 function. This function runs the result string of a REPL line through a regex, 
in order to remove the "resX:" part. The function returns the empty string in 
case the line does not start with "resX:", therefore returning an empty string 
for import statements and other declarations. This can have several subtle side 
effects, such as TOREE-340, or a toree client never completing the "onResult" 
callback.

A quick fix to this issue is to return the result string as-is if it does not 
start with "resX". This leads me to a more general question: why is the resX 
stripped in the first place? I could see that in the context of a jupyter 
notebook, the res number may not necessarily match the cell number, however 
since res variables are still accessible and may actually be of utility for a 
user  


> Certain interpreter evaluations do not return result strings
> ------------------------------------------------------------
>
>                 Key: TOREE-365
>                 URL: https://issues.apache.org/jira/browse/TOREE-365
>             Project: TOREE
>          Issue Type: Bug
>            Reporter: Jakob Odersky
>
> The scala interpreter currently only returns results for expressions. Import 
> statements and declarations will not show up as results in a notebook 
> (although they are evaluated internally).
> This behaviour is related to the 
> [ScalaInterpreter#truncateResult|(https://github.com/apache/incubator-toree/blob/master/scala-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/scala/ScalaInterpreter.scala#L165-L187]
>  function. This function runs the result string of a REPL line through a 
> regex, in order to remove the "resX:" part. The function returns the empty 
> string in case the line does not start with "resX:", therefore returning an 
> empty string for import statements and other declarations. This can have 
> several subtle side effects, such as TOREE-340, or a toree client never 
> completing the "onResult" callback.
> A quick fix to this issue is to return the result string as-is if it does not 
> start with "resX".



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

Reply via email to