[ 
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: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to