File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed
core/src/main/scala/org/apache/spark/rdd Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -1215,10 +1215,14 @@ abstract class RDD[T: ClassTag](
12151215 * where the JobConf/Configuration object is not thread-safe.
12161216 */
12171217 @ transient private [spark] lazy val broadcasted : Broadcast [Array [Byte ]] = {
1218- // TODO: Warn users about very large RDDs.
12191218 val ser = SparkEnv .get.closureSerializer.newInstance()
12201219 val bytes = ser.serialize(this ).array()
1221- logDebug(s " Broadcasting RDD $id using ${bytes.length} bytes " )
1220+ val size = Utils .bytesToString(bytes.length)
1221+ if (bytes.length > (1L << 20 )) {
1222+ logWarning(s " Broadcasting RDD $id ( $size), which contains large objects " )
1223+ } else {
1224+ logDebug(s " Broadcasting RDD $id ( $size) " )
1225+ }
12221226 sc.broadcast(bytes)
12231227 }
12241228
You can’t perform that action at this time.
0 commit comments