小白最近在工作中遇到,从hive表中向服务器导出txt文档的问题,之前没有注意到一个问题:
情景一:导入到csv文件
之前一直是将hive表中的查询结果导入到csv文件中,用下面的语句执行:
每次的csv文件都是覆盖上一次的结果
file_path="/home/chen"
file_name_t="test.csv"
hive -e "set hive.resultset.use.unique.column.names=false;set hive.cli.print.header=true;
select
d,
count(distinct orderid) as ordernum,
sum(roomnum) as roomnum,
sum(roomprice)as roomprice
from table
where d >='${zdt.addDay(-10).format("yyyy-MM-dd")}'
and d < '${zdt.format("yyyy-MM-dd")}'
group by d
;" >> $file_path/$file_name_t
情景二:导入到txt文件
但是,小白在将上面语句同样的,把导出文件换成txt,就出现了问题,大家可以看下有没有遇到过类似的情况
file_path="/home/chen"
file_name_t="test.txt"
hive -e "set hive.resultset.use.unique.column.names=false;set hive.cli.print.header=true;
select
d,
count(distinct or

最低0.47元/天 解锁文章
4万+

被折叠的 条评论
为什么被折叠?



