hive查询结果输出到hdfs上

insert overwrite directory "/mapredOutput/UserYesterdayInterest/${hiveconf:day}"
row format delimited fields terminated by "\t"
select
s.userid,
round(sum((s.totaloninvestedshare * i.yield/100 + s.addshare * s.addyield/100)/365),2) as yesterdayInterest,
unix_timestamp() as day
from
zx_standard_statistics s
left join zx_accounts a
on s.userid = a.userid
left join zx_standard_informations i
on s.bidno = i.bidno
where
a.totaloninvest > 0.00 and
s.totaloninvestedshare > 0 and
i.bidtype <> 'GREEN' and
i.startdate < unix_timestamp()
group by s.userid
;

将上述sql保存到yesterdayInetrest.sql文件中

执行hive -hiveconf day=20171204 -f yesterdayInterest.sql   实现参数传递

上一篇:Why we made vorlon.js and how to use it to debug your JavaScript remotely


下一篇:struts标签与jstl标签互换