I am using spark-csv to load data into a DataFrame. I want to do a simple query and display the content:
val df = sqlContext.read.format(\"com.databricks.spa
results.show(20, false)
will not truncate. Check the source
try this command :
df.show(df.count())
Within Databricks you can visualize the dataframe in a tabular format. With the command:
display(results)
It will look like
The other solutions are good. If these are your goals:
These two lines are useful ...
df.persist
df.show(df.count, false) // in Scala or 'False' in Python
By persisting, the 2 executor actions, count and show, are faster & more efficient when using persist
or cache
to maintain the interim underlying dataframe structure within the executors. See more about persist and cache.
The following answer applies to a Spark Streaming application.
By setting the "truncate" option to false, you can tell the output sink to display the full column.
val query = out.writeStream
.outputMode(OutputMode.Update())
.format("console")
.option("truncate", false)
.trigger(Trigger.ProcessingTime("5 seconds"))
.start()
results.show(20,false)
did the trick for me in Scala.