Skip to content

Commit 6325fc1

Browse files
committed
bugfix: bid >= 0
1 parent e0131a2 commit 6325fc1

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

core/src/main/scala/org/apache/spark/api/python/PythonRDD.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ private[spark] class PythonRDD(
211211
for (bid <- bids) {
212212
if (!nbids.contains(bid)) {
213213
// remove the broadcast from worker
214-
dataOut.writeLong(-bid)
214+
dataOut.writeLong(- bid - 1) // bid >= 0
215215
bids.remove(bid)
216216
}
217217
}

python/pyspark/worker.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,12 @@ def main(infile, outfile):
6969
ser = CompressedSerializer(pickleSer)
7070
for _ in range(num_broadcast_variables):
7171
bid = read_long(infile)
72-
if bid > 0:
72+
if bid >= 0:
7373
value = ser._read_with_length(infile)
7474
_broadcastRegistry[bid] = Broadcast(bid, value)
7575
else:
76-
_broadcastRegistry.pop(-bid, None)
76+
bid = - bid - 1
77+
_broadcastRegistry.pop(bid, None)
7778

7879
command = pickleSer._read_with_length(infile)
7980
(func, deserializer, serializer) = command

0 commit comments

Comments
 (0)