Skip to content

Commit 8838805

Browse files
author
Pedro Bernardo
committed
Added rdd/reduce/ReduceExample.py
1 parent 50dcbc6 commit 8838805

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

rdd/reduce/ReduceExample.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
from pyspark import SparkContext
2+
3+
if __name__ == "__main__":
4+
sc = SparkContext("local", "reduce")
5+
inputIntegers = [1, 2, 3, 4, 5]
6+
integerRdd = sc.parallelize(inputIntegers)
7+
product = integerRdd.reduce(lambda x, y: x * y)
8+
print("product is :{}".format(product))

0 commit comments

Comments
 (0)