Broadcast.
load
Read a pickled representation of value from the open file or socket.
BinaryIO
File or socket where the pickled value will be read.
The object hierarchy specified therein reconstituted from the pickled representation of an object.
Examples
>>> import os >>> import tempfile
>>> b = spark.sparkContext.broadcast([1, 2, 3, 4, 5]) >>> c = spark.sparkContext.broadcast(1)
Read the pickled representation of value from the open temp file.
>>> with tempfile.TemporaryDirectory() as d: ... path = os.path.join(d, "test.txt") ... with open(path, "wb") as f: ... b.dump(b.value, f) ... with open(path, "rb") as f: ... c.load(f) [1, 2, 3, 4, 5]