2017-01-19 40 views
1

我想通过下面的命令行参数,但它不工作。任何人都可以帮我解决我在这里做错的事!将参数传递给配置单元查询

hive -f test2.hql -hiveconf partition=20170117 -hiveconf -hiveconf datepartition=20170120 

回答

0

查询文件前通过你的论点,

hive --hiveconf partition='20170117' --hiveconf datepartition='20170120' -f test2.hql 

而且在使用它们的查询在test2.hql这样的,

${hiveconf:partition} 

示例:

select * from tablename where partition=${hiveconf:partition} and date=${hiveconf:datepartition} 
+0

谢谢,它工作 – Babu

0

一些替代方案:

1)如果使用蜂巢命令行,你可以详细阐述了整个SQL命令并执行它想:

hive -e <command> 

和明确的参数文字。

2)如果用直线(首选蜂巢),只是追加此命令行:

--hivevar myparam='myvalue'