zero323 commented on a change in pull request #35252:
URL: https://github.com/apache/spark/pull/35252#discussion_r798446234
##########
File path: python/pyspark/rdd.py
##########
@@ -1534,15 +1768,23 @@ def top(self, num, key=None):
[4, 3, 2]
"""
- def topIterator(iterator):
+ def topIterator(iterator: Iterable[T]) -> Iterable[List[T]]:
yield heapq.nlargest(num, iterator, key=key)
- def merge(a, b):
+ def merge(a: List[T], b: List[T]) -> List[T]:
return heapq.nlargest(num, a + b, key=key)
return self.mapPartitions(topIterator).reduce(merge)
- def takeOrdered(self, num, key=None):
+ @overload
+ def takeOrdered(self: "RDD[S]", num: int) -> "List[S]":
Review comment:
Thank for pointing this our ‒ it is just an inconsistency. In general we
have to quote *at least* `S`, because it is not available on runtime. Quoting
more is fine and has no impact on the interpretation of the hint. Let me adjust
this.
Hopefully, we'll be able to drop quotes completely before the next release,
but not before we finish the migration and do all post migration cleanup.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]