April 2017
Intermediate to advanced
532 pages
12h 39m
English
Another core feature of Spark is the ability to create two special types of variables--broadcast variables and accumulators.
A broadcast variable is a read-only variable that is created from the driver program object and made available to the nodes that will execute the computation. This is very useful in applications that need to make the same data available to the worker nodes in an efficient manner, such as distributed systems. Spark makes creating broadcast variables as simple as calling a method on SparkContext, as follows:
val broadcastAList = sc.broadcast(List("a", "b", "c", "d", "e"))
A broadcast variable can be accessed from nodes other than the driver program that created it (that is, the worker ...
Read now
Unlock full access