Josh Rosen created SPARK-4423:
---------------------------------

             Summary: Improve foreach() documentation to avoid confusion 
between local- and cluster-mode behavior
                 Key: SPARK-4423
                 URL: https://issues.apache.org/jira/browse/SPARK-4423
             Project: Spark
          Issue Type: Improvement
          Components: Documentation
            Reporter: Josh Rosen


{{foreach}} seems to be a common source of confusion for new users: in 
{{local}} mode, {{foreach}} can be used to update local variables on the 
driver, but programs that do this will not work properly when executed on 
clusters, since the {{foreach}} will update per-executor variables (note that 
this _will_ work correctly for accumulators, but not for other types of mutable 
objects).

Similarly, I've seen users become confused when {{.foreach(println)}} doesn't 
print to the driver's standard output.

At a minimum, we should improve the documentation to warn users against unsafe 
uses of {{foreach}} that won't work properly when transitioning from local mode 
to a real cluster.

We might also consider changes to local mode so that its behavior more closely 
matches the cluster modes; this will require some discussion, though, since any 
change of behavior here would technically be a user-visible 
backwards-incompatible change (I don't think that we made any explicit 
guarantees about the current local-mode behavior, but someone might be relying 
on the current implicit behavior).



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