You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2022/02/03 06:22:28 UTC

[GitHub] [spark] viirya commented on a change in pull request #35252: [SPARK-37154][PYTHON] Inline hints for pyspark.rdd

viirya commented on a change in pull request #35252:
URL: https://github.com/apache/spark/pull/35252#discussion_r798241351



##########
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:
       Hmm, why for `top`, it is:
   
   `def top(self: "RDD[S]", num: int) -> List["S"]:`
   
   but here it isn't:
   
   `def takeOrdered(self: "RDD[S]", num: int) -> List["S"]:`




-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org