在配置单元脚本中指定默认参数值 [英] Specify default parameter values within a hive script
本文介绍了在配置单元脚本中指定默认参数值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
> hive - eUSE uk_pers_dev; set hive.cli.print.header = true; CREATE TABLE IF NOT EXISTS $ {hiveconf:tablename}(mycol int); SELECT * FROM $ {hiveconf:tablename}; -hiveconf tablename = mytable;
然而我想要做的是在我的配置单元脚本中指定一个默认的参数值,如果没有值从命令行传递。这是可能的吗?
解决方案
好吧,请将逻辑从Hive中移除
在POSH或cmd文件中
- 检查
- 如果需要替换 >
- 调用配置单元
也许把它看作是一个包装。 b $ b
Allan
I am aware that it is possible to specify parameters for a hive query/script like so:
>hive -e "USE uk_pers_dev;set hive.cli.print.header=true;CREATE TABLE IF NOT EXISTS ${hiveconf:tablename} (mycol int);SELECT * FROM ${hiveconf:tablename};" -hiveconf tablename=mytable;
However what I would like to do is specify a default parameter value within my hive script that should be used in case no value is passed from the command-line. Is that possible?
解决方案
OK So take the logic away from Hive
In POSH or a cmd file
- Do the check
- Substitute if needed
- Call Hive
Maybe look at that as a wrapper.
Allan
这篇关于在配置单元脚本中指定默认参数值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文