1
我想通過下面的命令行參數,但它不工作。任何人都可以幫我解決我在這裏做錯的事!將參數傳遞給配置單元查詢
hive -f test2.hql -hiveconf partition=20170117 -hiveconf -hiveconf datepartition=20170120
我想通過下面的命令行參數,但它不工作。任何人都可以幫我解決我在這裏做錯的事!將參數傳遞給配置單元查詢
hive -f test2.hql -hiveconf partition=20170117 -hiveconf -hiveconf datepartition=20170120
查詢文件前通過你的論點,
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}
一些替代方案:
1)如果使用蜂巢命令行,你可以詳細闡述了整個SQL命令並執行它想:
hive -e <command>
和明確的參數文字。
2)如果用直線(首選蜂巢),只是追加此命令行:
--hivevar myparam='myvalue'
謝謝,它工作 – Babu