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

Kevin Bates closed TOREE-503.
-----------------------------
    Fix Version/s: 0.3.0
         Assignee: Kevin Bates
       Resolution: Workaround

This appears to only be an issue if Toree is used on pre Spark 2.4 systems.  It 
cannot be reproduced on Spark 2.4+.  Since the same version of Toree is used in 
both cases, this implies this is probably something in Spark or some subtle 
variation related to the version of Spark.

I chose 'Workaround' because this issue can be worked around if the method and 
call to the method are in the same cell (for Spark < 2.4).  The other 
workaround is to upgrade to Spark 2.4, in which case the locality requirement 
is not applicable.

> Cannot Use Scala Enumerations as Method Arguments
> -------------------------------------------------
>
>                 Key: TOREE-503
>                 URL: https://issues.apache.org/jira/browse/TOREE-503
>             Project: TOREE
>          Issue Type: Bug
>          Components: Kernel
>    Affects Versions: 0.3.0
>         Environment: Amazon EMR Release emr-5.10.0, JupyterLab 0.35.4
>            Reporter: Alexander Gunter
>            Assignee: Kevin Bates
>            Priority: Major
>             Fix For: 0.3.0
>
>
> Under common circumstances, cells containing method calls where an argument 
> is an Enumeration will fail to compile when using the Toree kernel in 
> JupyterLab. The circumstances relate to the scoping between notebook cells. 
> The arrangement below will fail to compile, producing the shown output.
>  
> _CELL 1:_
> {code:java}
> object ExampleEnum extends Enumeration {
>    type ExampleEnum = Value
>    val A, B, C = Value
>  }{code}
> {code:java}
> defined object ExampleEnum
> {code}
>  
> _CELL 2:_
> {code:java}
> def exampleMethod(enum: ExampleEnum.Value): Unit = {
>   println(enum.toString)
> }
> exampleMethod(ExampleEnum.A){code}
> {code:java}
> exampleMethod: (enum: ExampleEnum.Value)Unit
> A
> {code}
>  
> _CELL 3:_
> {code:java}
> exampleMethod(ExampleEnum.A){code}
> {code:java}
> Name: Compile Error
> Message: <console>:30: error: type mismatch;
>  found   : ExampleEnum.Value
>  required: ExampleEnum.Value
>        exampleMethod(ExampleEnum.A)
>                                  ^
> StackTrace: 
> {code}
>  
> Note that exampleMethod() works as expected when called inside the same cell 
> as its definition (demo'd in Cell 2). It also works as expected in all cells 
> if it is instead defined in Cell 1 alongside ExampleEnum (i.e. if you merge 
> Cell1 and Cell 2).



--
This message was sent by Atlassian Jira
(v8.3.2#803003)

Reply via email to