Show Headings (Column Names) in spark-sql CLI Result

visibility 450 access_time 2 years ago languageEnglish

In Spark-SQL CLI tool, the result print will omit headings (column names) by default. To display columns, we need to update Spark setting spark.hadoop.hive.cli.print.header.

Update Spark defaults file

To make the changes for all spark-sql sessions, edit file $SPARK_HOME/conf/spark-defaults.conf.

Add the following line into the file:

spark.hadoop.hive.cli.print.header true

Pass config value when starting session

If you only want to make this config effective for the session, start spark-sql CLI with the following argument:

spark-sql --conf "spark.hadoop.hive.cli.print.header=true"
copyright This page is subject to Site terms.

Please log in or register to comment.

account_circle Log in person_add Register

Log in with external accounts

timeline Stats
Page index 0.88
More from Kontext
Spark SQL - LAG Window Function
visibility 5,644
thumb_up 0
access_time 2 years ago
Spark SQL - Date and Timestamp Function
visibility 1,118
thumb_up 0
access_time 2 years ago
Write and read parquet files in Python / Spark
visibility 10,504
thumb_up 0
access_time 2 years ago