Hive query output delimiter

时间秒杀一切 提交于 2019-11-28 09:31:49

First of all, you need to change you field delimiter , not your line delimiter ie.

hive >> CREATE TABLE some_table 
        (col1 int,
         col2 int,
         col3 string)
        ROW FORMAT DELIMITED
        FIELDS TERMINATED BY ','
        STORED AS TEXTFILE;

Secondly, if you still face this issue, you can simply change it using sed.

bash >> hive -e 'select * from some_Table' | sed 's/[\t]/,/g'  > outputfile.txt

Please not that [\t] is to press Control+V and then the tab char:

sed 's/<Control+V><TAB character>/,/g'
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!