Uploaded image for project: 'Spark'
  1. Spark
  2. SPARK-572

Forbid update of static mutable variables

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Resolution: Won't Fix
    • None
    • None
    • None
    • None

    Description

      Consider the following piece of 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 ...})
       }
      }
      

      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...

      Attachments

        Activity

          People

            Unassigned Unassigned
            tjhunter tjhunter (Inactive)
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: