I can't quite get the behavior of lambda in following code:
rdd = sc.parallelize([5,3,1,2)]
rdd.takeOrdered(3,lambda s: -1*s)
From what I have understood, lambda applies an operation to all elements in a list, so I expected above code to return
[-1,-2,-3]
But it returned
[5,3,2]
What am I missing here?
https://spark.apache.org/docs/1.1.1/api/python/pyspark.rdd.RDD-class.html
so in your example you are providing an order function.