Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Threaded View
Hive >> mail # user >> export csv, use ',' as split


Copy link to this message
-
Re: export csv, use ',' as split
Hive does not have a output delimiter specifier yet (not sure if 0.11.x may have it)

But for now please try the following

hive -e myquery | sed 's/\t/,/g' >> result.csv

Good luck

Sanjay

From: kentkong_work <[EMAIL PROTECTED]<mailto:[EMAIL PROTECTED]>>
Reply-To: "[EMAIL PROTECTED]<mailto:[EMAIL PROTECTED]>" <[EMAIL PROTECTED]<mailto:[EMAIL PROTECTED]>>
Date: Tuesday, July 9, 2013 9:48 PM
To: user <[EMAIL PROTECTED]<mailto:[EMAIL PROTECTED]>>
Subject: export csv, use ',' as split

hi here,
   I create a table like this and put a lot data into it.
   then I export query result into csv file like this:
    hive -e myquery >> result.csv

   but the csv uses tab as split.
   how to make hive use ','? thanks!

CREATE TABLE if not exists upload_users(
  username string,
  mobile string,
  id_type string,
  id_no string,
  email string,
  address string,
  validate_time string
) partitioned by (fileid string)
row format delimited fields terminated by "\,";

CONFIDENTIALITY NOTICE
=====================This email message and any attachments are for the exclusive use of the intended recipient(s) and may contain confidential and privileged information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message along with any attachments, from your computer system. If you are the intended recipient, please be advised that the content of this message is subject to access, review and disclosure by the sender's Email System Administrator.