4

When performing:

hive -e 'select * from database.table' > /localfilesystem/mytable.txt

the column header names are in the form database.columnname and I would like them to be columnname only. Is there a way to supress the database in the columnname when performing the above type of query?

2
  • Did you try hive -e 'USE database; select * from table' > .... I'm slightly confused by the question, As I understand the column names in header are tablename.columnname. May be you are using a different version of hive.
    – Shyam
    Jul 30, 2015 at 0:17
  • We were using hive 0.08 and all we got was calling name without the database. Then we move to 0.13. and now the database is in the name of the column Jul 30, 2015 at 0:20

1 Answer 1

10

hive.resultset.use.unique.column.names was added in 0.13 and defaults to True. Just set it to false in your ~/.hiverc or in hive-site.xml

 <property>
   <name>hive.resultset.use.unique.column.names</name>
   <value>false</value>
 </property> 

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.