如何通过Hive脚本传递Env变量?

发布于 2025-02-02 01:53:54 字数 243 浏览 4 评论 0原文

我有一个带有test.hql的HQL脚本 因为我在查询日期中有这样的env变量 我该如何将论点传递给HQL 如果是hiveconf或hivevar,我们

hive -f --hiveconf date='20220526' test.hql

会像某些人一样

hive -f --env date='20220526' test.hql

运行脚本

I have a hql script with test.hql
in that i'm having env variable like this in query date='${env:date}'
how can i pass an argument to the hql
if it is hiveconf or hivevar we run script like

hive -f --hiveconf date='20220526' test.hql

can some one tell how will we pass env variable

hive -f --env date='20220526' test.hql

i'm not able to pass like above

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

请帮我爱他 2025-02-09 01:53:54

环境变量将由外壳解释,而不是查询。

export DATE='20220526' 
hive -f --hiveconf date="$DATE" test.hql

另外,应使用Beeline而不是弃用的Hive CLI

Environment variables would be interpreted by the shell, not a query.

export DATE='20220526' 
hive -f --hiveconf date="$DATE" test.hql

Also, beeline should be used rather than deprecated Hive cli

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文