How do I output the results of a HiveQL query to CSV?

前端 未结 18 1723
独厮守ぢ
独厮守ぢ 2020-11-27 10:11

we would like to put the results of a Hive query to a CSV file. I thought the command should look like this:

insert overwrite directory \'/home/output.csv\'          


        
18条回答
  •  旧时难觅i
    2020-11-27 10:49

    You can use hive string function CONCAT_WS( string delimiter, string str1, string str2...strn )

    for ex:

    hive -e 'select CONCAT_WS(',',cola,colb,colc...,coln) from Mytable' > /home/user/Mycsv.csv
    

提交回复
热议问题