Is there any way to get the column name along with the output while execute any query in Hive?

前端 未结 7 1227
醉话见心
醉话见心 2020-12-23 02:17

In Hive, when we do a query (like: select * from employee), we do not get any column names in the output (like name, age, salary that we would get in R

7条回答
  •  失恋的感觉
    2020-12-23 03:02

    To print header along with the output, the following hive conf property should be set to true before executing the query.

    hive> set hive.cli.print.header=true;
    hive> select * from table_name;
    

    We can also use query like this, if we want to get result in file.

    hive -e 'set hive.cli.print.header=true;select * from table_name;' > result.xls
    

    Where table_name your table name

提交回复
热议问题