You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Raphael Roth (JIRA)" <ji...@apache.org> on 2017/05/11 06:55:04 UTC

[jira] [Updated] (SPARK-20706) Spark-shell not overriding method definition

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

Raphael Roth updated SPARK-20706:
---------------------------------
    Description: 
In the following example, the definition of myMethod is not correctly updated:

------------------------------
def myMethod()  = "first definition"

val tmp = myMethod(); val out = tmp

println(out) // prints "first definition"

def myMethod()  = "second definition" // override above myMethod

val tmp = myMethod(); val out = tmp 

println(out) // should be "second definition" but is "first definition"
------------------------------

So if I-redefine myMethod, the implementation seems not to be updated in this case. I figured out that the second-last statement (val out = tmp) causes this behavior, if this is moved in a separate block, the code works just fine.

  was:
In the following example, the definition of myMethod is not correctly updated:

def myMethod()  = "first definition"

val tmp = myMethod(); val out = tmp

println(out) // prints "first definition"

def myMethod()  = "second definition" // override above myMethod

val tmp = myMethod(); val out = tmp 

println(out) // should be "second definition" but is "first definition"


So if I-redefine myMethod, the implementation seems not to be updated in this case. I figured out that the second-last statement (val out = tmp) causes this behavior, if this is moved in a separate block, the code works just fine.


> Spark-shell not overriding method definition
> --------------------------------------------
>
>                 Key: SPARK-20706
>                 URL: https://issues.apache.org/jira/browse/SPARK-20706
>             Project: Spark
>          Issue Type: Bug
>          Components: Spark Shell
>    Affects Versions: 2.0.0
>         Environment: Linux, Scala 2.11.8
>            Reporter: Raphael Roth
>
> In the following example, the definition of myMethod is not correctly updated:
> ------------------------------
> def myMethod()  = "first definition"
> val tmp = myMethod(); val out = tmp
> println(out) // prints "first definition"
> def myMethod()  = "second definition" // override above myMethod
> val tmp = myMethod(); val out = tmp 
> println(out) // should be "second definition" but is "first definition"
> ------------------------------
> So if I-redefine myMethod, the implementation seems not to be updated in this case. I figured out that the second-last statement (val out = tmp) causes this behavior, if this is moved in a separate block, the code works just fine.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org