1.hive通过外部设置参数传入脚本中:
hive -hiveconf enter_school_date="20130902" -hiveconf min_ag="26" -f testvar.sql
脚本调用参数:use test;
select * from student where pdate='${hiveconf:enter_school_date}' and sage > '${hiveconf:min_ag}' limit 8;
hive -hiveconf enter_school_date="20130902" -hiveconf min_ag="26" -f testvar.sql
脚本调用参数:use test;
select * from student where pdate='${hiveconf:enter_school_date}' and sage > '${hiveconf:min_ag}' limit 8;