I am trying to load hive query output into a csv file, when i run below script
hive -e "select * from mytable" > output.csv
i want the output of row fields should be separated by commas.
I am trying to load hive query output into a csv file, when i run below script
hive -e "select * from mytable" > output.csv
i want the output of row fields should be separated by commas.
You can write a sql query for that, which would be less error prone.
INSERT OVERWRITE LOCAL DIRECTORY '/tmp/mytable/data'
ROW FORMAT DELIMITED
FIELDS TERMINATED BY ','
LINES TERMINATED BY "\n"
SELECT * FROM mytable;
if you have a beeline, it has an option to export the data into csv.
beeline --outputformat=csv2 -e "select * from mytable" > mytable.csv