scrayon
scrayon

Reputation: 497

Writing column header for hive output with union all

I am looking at ways to write a column header to hive output (actually trailer as well) and have only been able to get close using union all. Example

select "age" as age, "name" as name, "address" as address union all select age, name, address from customers

the problem is that union all will not necessarily place the first select as the header. Is there another solution or do you suggest I do not do this in Hive at all and use unix

thanks

Upvotes: 0

Views: 887

Answers (1)

Partha Kaushik
Partha Kaushik

Reputation: 690

set hive.cli.print.header=true;

The above hive property will print column names/header as you expected.

Upvotes: 1

Related Questions