hive通过-f调用文件并传递参数
1、hive在0.9之前的版本中, -f调用文件是不能传入参数的,因此我们做了 hiveF的封装。
参考文章:
http://blog.youkuaiyun.com/kwu_ganymede/article/details/49252625
2、hive在1.0版本之后,支持了hive -f 的参数传递,且支持多参数的传递
使用如下:
test.sql
select * from ods.tracklog where day='${hiveconf:day}' and requesturl like '%${hiveconf:url}%' limit 15
调用方式如下:
hive -hiveconf day=20151115 -hiveconf url=licaike -f test.sql
3、总结,生产中 hive -e 与 hive -f 都可以使用,hive -f 解决了参数传递的问题将更多的用在生产中