You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Lars Francke (JIRA)" <ji...@apache.org> on 2015/07/29 13:56:05 UTC

[jira] [Updated] (SPARK-572) Forbid update of static mutable variables

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

Lars Francke updated SPARK-572:
-------------------------------
    Description: 
Consider the following piece of code:
{code}
object Foo {
 var xx = -1

 def main() {
   xx = 1
   val sc = new SparkContext(...)
   sc.broadcast(xx)
   sc.parallelize(0 to 10).map(i=>{ ... xx ...})
 }
}
{code}
Can you guess the value of xx? It is 1 when you use the local scheduler and -1 when you use the mesos scheduler. Given the complications, it should probably just be forbidden for now...

  was:
Consider the following piece of code:
<pre>
object Foo {
 var xx = -1

 def main() {
   xx = 1
   val sc = new SparkContext(...)
   sc.broadcast(xx)
   sc.parallelize(0 to 10).map(i=>{ ... xx ...})
 }
}
</pre>
Can you guess the value of xx? It is 1 when you use the local scheduler and -1 when you use the mesos scheduler. Given the complications, it should probably just be forbidden for now...


> Forbid update of static mutable variables
> -----------------------------------------
>
>                 Key: SPARK-572
>                 URL: https://issues.apache.org/jira/browse/SPARK-572
>             Project: Spark
>          Issue Type: Improvement
>            Reporter: tjhunter
>
> Consider the following piece of code:
> {code}
> object Foo {
>  var xx = -1
>  def main() {
>    xx = 1
>    val sc = new SparkContext(...)
>    sc.broadcast(xx)
>    sc.parallelize(0 to 10).map(i=>{ ... xx ...})
>  }
> }
> {code}
> Can you guess the value of xx? It is 1 when you use the local scheduler and -1 when you use the mesos scheduler. Given the complications, it should probably just be forbidden for now...



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

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