hive查询结果如何以csv的格式存储到本地磁盘
方式一
INSERT OVERWRITE LOCAL DIRECTORY '/tmp/data.csv' select books from table;
或者存储到hdfs
INSERT OVERWRITE DIRECTORY '/user/data.csv' select books from table;
方式二
hive -e 'select books from table' | sed 's/[[:space:]]\+/,/g' > /tmp/data.csv
或者
hive -e 'select books from table' | sed 's/[\t]\+/,/g' > /tmp/data.csv
记录学习和生活的酸甜苦辣.....哈哈哈