匯出hive表資料的5種方法
阿新 • • 發佈:2019-01-06
下面介紹一下hive 匯出的幾種方式
- 本地檔案直接匯出
insert overwrite local directory '/data/hive/export/student_info' select * from default.student
- 修改分隔符和換行符
insert overwrite local directory '/data/hive/export/student_info' ROW FORMAT DELIMITED FIELDS TERMINATED BY '\t' COLLECTION ITEMS TERMINATED BY '\n' select * from default.student
- shell 指令碼匯出
bin/hive -e "select * from default.student_info ;" > /data/hive/export/local/student_info
- 匯出資料到檔案系統
insert overwrite directory '/data/hive/export/student_info' select * from default.student
- export 方法
export table student_info partition (country="china") to "/data/hive/export/"