Github user davies commented on a diff in the pull request:
https://github.com/apache/spark/pull/2094#discussion_r16631953
--- Diff: python/pyspark/rdd.py ---
@@ -810,23 +810,45 @@ def func(iterator):
return self.mapPartitions(func).fold(zeroValue, combOp)
- def max(self):
+ def max(self, comp=None):
"""
Find the maximum item in this RDD.
- >>> sc.parallelize([1.0, 5.0, 43.0, 10.0]).max()
+ @param comp: A function used to compare two elements, the builtin
`cmp`
--- End diff --
We already use `key` in Python instead of `Ordering` in Scala, so I had
change it into `key`.
Also , I would like to add `key` to top(), will be helpful, such as:
rdd.map(lambda x: (x, 1)).reduce(add).top(20, key=itemgetter(1))
We already have `ord` in Scala. Should I add this in this PR?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]