Nina Volfenzon
Nina Volfenzon

Reputation: 33

print table headers only in Hive

Is it possible to print headers in Hive without the table name prefix?

I did: set hive.cli.print.header=true;

and then: select * from brands limit 3;

the result was:

brands.id  brands.name brands.tag      brands.value
7     Brand      50      DeLorme
0     Brand      50      U-Line
27    Brand      50      Elcon

And what really wanted to get is:

id    name       tag      value
7     Brand      50      DeLorme
0     Brand      50      U-Line
27    Brand      50      Elcon

"brands" is a table that I created and not a main DB table.

Thanks for your help,
Nina

Upvotes: 3

Views: 3365

Answers (1)

David דודו Markovitz
David דודו Markovitz

Reputation: 44911

set hive.resultset.use.unique.column.names=false;

hive.resultset.use.unique.column.names

Default Value: true.
Added In: Hive 0.13.0 with HIVE-6687

Make column names unique in the result set by qualifying column names with table alias if needed. Table alias will be added to column names for queries of type "select *" or if query explicitly uses table alias "select r1.x..".

https://cwiki.apache.org/confluence/display/Hive/Configuration+Properties

Upvotes: 6

Related Questions