Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding column headers to hive result set

I am using a hive script on Amazon EMR to analyze some data.

And I am transferring the output to Amazon s3 bucket. Now the results of hive script do not contain column headers.

I have also tried using this:

 set hive.cli.print.header=true;

But it does not help. Can you help me out?

like image 852
Sam Avatar asked Feb 28 '13 15:02

Sam


1 Answers

Exactly what does your hive script look like?

Does the output from your hive script have the header data in it? Is it then being lost when you copy the output to your s3 bucket?

If you could provide some more details about exactly what you are doing that would be helpful.

Without knowing those details, here is something that you could try.

Create your hive script as follows:

USE dbase_name:
SET hive.cli.print.header=true;
SELECT some_columns FROM some_table WHERE some_condition;

Then run your script:

$ hive -f hive_script.hql > hive_output

Then copy your output to your s3 bucket

$ aws s3 cp ./hive_output s3://some_bucket_name/foo/hive_output
like image 71
rchapin Avatar answered Nov 17 '22 10:11

rchapin