Skip to content

Commit 2e1c016

Browse files
committed
[SPARK-12760] [DOCS] invalid lambda expression in python example for local vs cluster
1 parent 85200c0 commit 2e1c016

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

docs/programming-guide.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -789,9 +789,12 @@ counter = 0
789789
rdd = sc.parallelize(data)
790790

791791
# Wrong: Don't do this!!
792-
rdd.foreach(lambda x: counter += x)
792+
def increment_counter(x):
793+
global counter
794+
counter += x
795+
rdd.foreach(increment_counter)
793796

794-
print("Counter value: " + counter)
797+
print("Counter value: ", counter)
795798

796799
{% endhighlight %}
797800
</div>

0 commit comments

Comments
 (0)