Hive query output delimiter

后端 未结 1 1190
无人共我
无人共我 2020-12-09 14:10

I have 2 tables in Hive - first is external, the second one is managed. Managed table is populated from external using INSERT OVERWRITE...SELECT FROM external_table. Both ta

相关标签:
1条回答
  • 2020-12-09 14:46

    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'
    
    0 讨论(0)
提交回复
热议问题