power
power

Reputation: 1760

How can I specifiy which delimiter a command line Hive query should return?

I am using command line Hive. For example hive -e "SELECT * FROM my_db.my_table;"

It is currently returning what looks like tab separated values. Is it possible to specify which delimiter it should use? For example, can I make it return pipe separated values?

Upvotes: 0

Views: 153

Answers (1)

Sravan K Reddy
Sravan K Reddy

Reputation: 1082

  what i am done in my case, i fired a query like below.  

  INSERT OVERWRITE LOCAL DIRECTORY '/home/Desktop/test3'
  ROW FORMAT DELIMITED 
  FIELDS TERMINATED BY ','
  select * from stud_02


  other solution would be 

   hive -e 'select *  from stud_01 limit 10' | sed 's/[[:space:]]\+/,/g' >> /home/Desktop/test.csv

Upvotes: 1

Related Questions