cancel
Showing results forย 
Search instead forย 
Did you mean:ย 
Data Engineering
Join discussions on data engineering best practices, architectures, and optimization strategies within the Databricks Community. Exchange insights and solutions with fellow data engineers.
cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

rdd.foreachPartition() does nothing?

p42af
New Contributor

I expected the code below to print "hello" for each partition, and "world" for each record. But when I ran it the code ran but had no print outs of any kind. No errors either. What is happening here?

%scala
 
val rdd = spark.sparkContext.parallelize(Seq(1,2,3,4,5,6,7,8))
rdd.foreachPartition(partition => {
 println("hello")
 partition.foreach(fun=>{
   println("world")
 })
})

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @Leon Pโ€‹ ,

You will need to check the executor's logs. Check the Stdout

View solution in original post

4 REPLIES 4

RKNutalapati
Valued Contributor

Check your stdout logs

Hubert-Dudek
Esteemed Contributor III

Is it lazy evaluated so you need to trigger action I guess

Hi @Leon Pโ€‹ ,

You will need to check the executor's logs. Check the Stdout

Hi @Leon Pโ€‹ ,

Just a friendly follow-up. Do you still need help or you were able to check the executor's logs and find the messages?

Connect with Databricks Users in Your Area

Join a Regional User Group to connect with local Databricks users. Events will be happening in your city, and you wonโ€™t want to miss the chance to attend and share knowledge.

If there isnโ€™t a group near you, start one and help create a community that brings people together.

Request a New Group