javadba javadba - 3 months ago 16
Scala Question

How to suppress printing of variable values in zeppelin

Given the following snippet:

val data = sc.parallelize(0 until 10000)
val local = data.collect
println(s"local.size")


Zeppelin prints out the entire value of
local
to the notebook screen. How may that behavior be changed?

Answer

What I do to avoid this is define a top-level function, and then call it:

def run() : Unit = {
    val data = sc.parallelize(0 until 10000)
    val local = data.collect 
    println(local.size)
}
run();
Comments