hive-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jason Dere <jd...@hortonworks.com>
Subject Re: Hive Query o/p to HDFS as CSV file
Date Fri, 09 Jan 2015 18:34:48 GMT
A workaround might be to create an external table with the correct format, insert overwrite
into the external table, then drop the external table (which I think shouldn't delete the
directory)


On Jan 9, 2015, at 5:46 AM, vengatesh.babu <vengatesh.babu@zohocorp.com> wrote:

> Hi,
> 
> How to write Hive query output to HDFS directory as CSV file(comma separated).
> 
> 
> Thanks
> Vengatesh Babu K M
> 
> ---- On Wed, 07 Jan 2015 11:46:39 +0530 vengatesh.babu<vengatesh.babu@zohocorp.com>
wrote ---- 
> 
> Hi,
> 
> I want to write hive query output into HDFS file in CSV Format( comma separated).
> 
> For LOCAL DIRECTORY:
> 
> INSERT OVERWRITE LOCAL DIRECTORY '/home/test/result/' 
> ROW FORMAT DELIMITED FIELDS TERMINATED BY ',' 
> SELECT * from table;
> 
> Above Works fine and writes output of query as CSV Format in local directory.
> 
> 
> For HDFS:
> 
> INSERT OVERWRITE DIRECTORY '/home/test/result/' 
> SELECT * from table;
> 
> output written to the HDFS is serialized as text with columns separated by ^A and rows
separated by newlines.
> 
> (NOTE : ROW FORMAT DELIMITED FIELDS  ---- Not supported for above query)
> 
> Is there any way to write hive query output in HDFS directory as CSV file(comma separated)
> 
> 
> Thanks
> Vengatesh Babu K M
> 
> 
> 


-- 
CONFIDENTIALITY NOTICE
NOTICE: This message is intended for the use of the individual or entity to 
which it is addressed and may contain information that is confidential, 
privileged and exempt from disclosure under applicable law. If the reader 
of this message is not the intended recipient, you are hereby notified that 
any printing, copying, dissemination, distribution, disclosure or 
forwarding of this communication is strictly prohibited. If you have 
received this communication in error, please contact the sender immediately 
and delete it from your system. Thank You.

Mime
View raw message