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   实现参数传递


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM