Naresh
Naresh

Reputation: 5397

Can i choose my own name for the output of hive queries with only one output file?

I get multiple output files of my hive queries. So, my first question is can i configure my output to be only in one file. Also, can i choose my own name of the output instead of 0000?

FYI, i am not using the jar file to submit job to hadoop. Instead of it i am using hive queries for my jobs. So, then how do i rename my output file names.

Upvotes: 1

Views: 1838

Answers (1)

Tariq
Tariq

Reputation: 34184

You can have a single file as the output by setting the number of reducers to 0. You can do this from the Hive CLI :

hive>  set mapred.reduce.tasks = 1;

Yes, you can change the name of the output file. You can subclass the OutputFormat.java class and write your own. You can look at the code of TextOutputFormat.java and MultipleOutputFormat.java etc. for reference. To do that you can just subclass that class and override the methods you need to change.

Upvotes: 3

Related Questions