Skip to content

Instantly share code, notes, and snippets.

@milindjagre
Created December 13, 2016 00:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save milindjagre/6ec99198782e0061be3b918eef809432 to your computer and use it in GitHub Desktop.
Save milindjagre/6ec99198782e0061be3b918eef809432 to your computer and use it in GitHub Desktop.
from pyspark import SparkConf, SparkContext
conf = SparkConf().setMaster("local").setAppName("Sum")
sc = SparkContext(conf = conf)
numbers = sc.parallelize([1, 2, 3, 4, 5])
sum = numbers.reduce(lambda x, y: x + y)
print "--------------"
print "SUM IS :", sum
print "--------------"
@milindjagre
Copy link
Author

This python file is used for performing addition operation with the help of the reduce action

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment