aboutsummaryrefslogtreecommitdiff
path: root/docs/programming-guide.md
diff options
context:
space:
mode:
authorRobertZK <technoguyrob@gmail.com>2015-03-07 00:16:50 +0000
committerSean Owen <sowen@cloudera.com>2015-03-07 00:39:24 +0000
commit48a723c98684c5bb3d185cada4888cae952791bd (patch)
treea1d3569eef72a0504a13ada9fef48ad72e7ec3bb /docs/programming-guide.md
parentdba0b2eadb441f41ded0f0b9706b720bcfa84881 (diff)
downloadspark-48a723c98684c5bb3d185cada4888cae952791bd.tar.gz
spark-48a723c98684c5bb3d185cada4888cae952791bd.tar.bz2
spark-48a723c98684c5bb3d185cada4888cae952791bd.zip
Fix python typo (+ Scala, Java typos)
Author: RobertZK <technoguyrob@gmail.com> Author: Robert Krzyzanowski <technoguyrob@gmail.com> Closes #4840 from robertzk/patch-1 and squashes the following commits: d286215 [RobertZK] lambda fix per @laserson 5937989 [Robert Krzyzanowski] Fix python typo
Diffstat (limited to 'docs/programming-guide.md')
-rw-r--r--docs/programming-guide.md17
1 files changed, 10 insertions, 7 deletions
diff --git a/docs/programming-guide.md b/docs/programming-guide.md
index 7b07018288..b5e04bd0c6 100644
--- a/docs/programming-guide.md
+++ b/docs/programming-guide.md
@@ -1336,25 +1336,28 @@ Accumulators do not change the lazy evaluation model of Spark. If they are being
<div data-lang="scala" markdown="1">
{% highlight scala %}
-val acc = sc.accumulator(0)
-data.map(x => acc += x; f(x))
-// Here, acc is still 0 because no actions have cause the `map` to be computed.
+val accum = sc.accumulator(0)
+data.map { x => accum += x; f(x) }
+// Here, accum is still 0 because no actions have caused the `map` to be computed.
{% endhighlight %}
</div>
<div data-lang="java" markdown="1">
{% highlight java %}
Accumulator<Integer> accum = sc.accumulator(0);
-data.map(x -> accum.add(x); f(x););
-// Here, accum is still 0 because no actions have cause the `map` to be computed.
+data.map(x -> { accum.add(x); return f(x); });
+// Here, accum is still 0 because no actions have caused the `map` to be computed.
{% endhighlight %}
</div>
<div data-lang="python" markdown="1">
{% highlight python %}
accum = sc.accumulator(0)
-data.map(lambda x => acc.add(x); f(x))
-# Here, acc is still 0 because no actions have cause the `map` to be computed.
+def g(x):
+ accum.add(x)
+ return f(x)
+data.map(g)
+# Here, accum is still 0 because no actions have caused the `map` to be computed.
{% endhighlight %}
</div>