dgadiraju
11/4/2017 - 5:59 PM

core-spark-aggregating-data.py

#Check out our lab for practice: https://labs.itversity.com

#Computing Daily revenue using reduceByKey
ordersJoinMap = ordersJoin.\
map(lambda r: ((r[1][0], r[1][1][0]), r[1][1][1]))

dailyRevenuePerProductId = ordersJoinMap.\
reduceByKey(lambda total, revenue: total + revenue)

for i in dailyRevenuePerProductId.take(10): print(i)

#Raise any issues on https://discuss.itversity.com - make sure to categorize properly