I have the following Spark dataframe that is created dynamically:
val sf1 = StructField(\"name\", StringType, nullable = true) val sf2 = StructField(\"sector
sqlDF.foreach is not working for me but Approach 1 from @Sarath Avanavu answer works but it was also playing with the order of the records sometime.
sqlDF.foreach
I found one more way which is working
df.collect().foreach { row => println(row.mkString(",")) }