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
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