zero323 commented on a change in pull request #34439:
URL: https://github.com/apache/spark/pull/34439#discussion_r753859161



##########
File path: python/pyspark/broadcast.py
##########
@@ -21,28 +21,47 @@
 from tempfile import NamedTemporaryFile
 import threading
 import pickle
+from typing import (
+    cast,
+    Any,
+    Callable,
+    Dict,
+    Generic,
+    IO,
+    Iterator,
+    Optional,
+    Tuple,
+    TypeVar,
+    TYPE_CHECKING,
+    Union,
+)
 
 from pyspark.java_gateway import local_connect_and_auth
 from pyspark.serializers import ChunkedStream, pickle_protocol
 from pyspark.util import print_exec
 
+if TYPE_CHECKING:
+    from pyspark import SparkContext
+
 
 __all__ = ["Broadcast"]
 
+T = TypeVar("T")
+
 
 # Holds broadcasted data received from Java, keyed by its id.
-_broadcastRegistry = {}
+_broadcastRegistry: Dict[int, "Broadcast"] = {}
 
 
-def _from_id(bid):
+def _from_id(bid: int) -> "Broadcast":

Review comment:
       `-> "Broadcast[Any]"`?




-- 
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]

Reply via email to