Scala println() in zeppelin paragraph doesn't print while regular print() prints well

Viewed 845

On zeppelin notebook, with working spark/scala interpreter, I'm trying to do the simplest task:

println("Hello World");

And when I run it, I get blank (nothing!) in the output part.
On the other hand, when I'm only using

print("Hello World");

Without the ln, it prints OK.
Any idea? Thanks in advance.

1 Answers

To me this look related to the stdout being in the driver or executors, and not about the specific instruction used (because in that case would be really odd).

At least my zeppelin instance (i'm on EMR) is only printing statement that are in the stdout on the driver, so is important WHERE your prints are.

I had a similar issue but it was because my print was inside a dataframe foreach, hence executed in the executors and not in the driver.

For example:

val dataset = spark.read.parquet(...)

println("This will be appeard")

dataset.foreach(println(_))
 //you won't see this since the print will happen in the executors


dataset.take(1).foreach(println(_))
//you should see this since happen in the driver after collecting the result

Try to see if you are doing something like that.

Related