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)