Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 617
WestCoastProjects Avatar asked Aug 05 '15 20:08

WestCoastProjects


3 Answers

You can also try adding curly brackets around your code.

{val data = sc.parallelize(0 until 10000)
val local = data.collect 
println(s"local.size")}
like image 107
Caner Avatar answered Sep 29 '22 16:09

Caner


Since 0.6.0, Zeppelin provides a boolean flag zeppelin.spark.printREPLOutput in spark's interpreter configuration (accessible via the GUI), which is set to true by default. If you set its value to false then you get the desired behaviour that only explicit print statements are output.

See also: https://issues.apache.org/jira/browse/ZEPPELIN-688

like image 31
cubic lettuce Avatar answered Sep 29 '22 15:09

cubic lettuce


FWIW, this appears to be new behaviour. Until recently we have been using Livy 0.4, it only output the content of the final statement (rather than echoing the output of the whole script).

When we upgraded to Livy 0.5, the behaviour changed to output the entire script.

While splitting the paragraph and hiding the output does work, it seems like an unnecessary overhead to the usability of Zeppelin. for example, if you need to refresh your output, then you have to remember to run two paragraphs (i.e. the one that sets up your output and the one containing the actual println).

There are, IMHO, other usability issues with this approach that makes, again IMHO, Zeppelin less intuitive to use.

Someone has logged this JIRA ticket to address "the problem", please vote for it: LIVY-507

like image 36
GMc Avatar answered Sep 29 '22 16:09

GMc