show()
Function in Sparkshow()
function in Spark is used to display the contents of a DataFrame or Dataset in a tabular format. It is one of the most commonly used actions in Spark for debugging and inspecting data. By default, show()
displays the first 20 rows of the DataFrame, but you can customize the number of rows and whether to truncate long strings.
SELECT * FROM table_name LIMIT n
to achieve similar results.True
, truncates long strings to 20 characters. If an integer is provided, truncates strings to that length.show()
is an action, meaning it triggers the execution of the Spark job.show()
triggers the execution of the entire DataFrame lineage, so use it carefully for large datasets.truncate=False
to display full strings.show()
function is used to display the contents of a DataFrame or Dataset in a tabular format.SELECT * FROM table_name LIMIT n
.