1. 导出到本地文件
insert overwrite local directory '/opt/data/hive_exp' select count(*) from hive_test.u_data ;
指定列分隔符 , 行分隔符
insert overwrite local directory '/opt/data/hive_exp' ROW FORMAT delimited fields terminated by '\t' COLLECTION ITEMS terminated by '\n' select * from hive_test.u_data ;
2. bin/hive -e管道输出
bin/hive -e "select count(*) from hive_test.u_data" > output.txt
3. 导出结果到hdfs
指定列分隔符 , 行分隔符
insert overwrite directory '/user/hadoop/data/hive_exp' ROW FORMAT delimited fields terminated by '\t' COLLECTION ITEMS terminated by '\n' select * from hive_test.u_data ;