apache spark - How to print the contents of a broadcast variable -
i created broadcast variable in pyspark shell , want inspect whats inside of it.
but, functions i'd use print or view rdd not available broadcast variable.
i.e. .collect()
, .take(5)
etc throw dreaded broadcast object has no property ...
errors.
how view data stored in broadcast var?
i guess in python similar. show example in scala.
scala> val broadcastvar = sc.broadcast(array(1, 2, 3)) broadcastvar: org.apache.spark.broadcast.broadcast[array[int]] = broadcast(0) scala> broadcastvar.value res0: array[int] = array(1, 2, 3)
if save result of broadcastvar.value, t, in variable can print or whatever using default tostring method of type t.
Comments
Post a Comment